from os.path import dirname, basename, isfile import glob modules = glob.glob(dirname(__file__)+"/*/ai.py") __all__ = ['.'.join(f.split('.')[:-1]) for f in modules if isfile(f)]