Created
July 12, 2016 23:08
-
-
Save Maome/d9509132d42fc0c41782591660c63832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imp | |
from glob import glob | |
import os | |
basedir = os.path.dirname(os.path.abspath(__file__)) | |
def load(): | |
modules = [] | |
paths = glob(os.path.join(basedir, "*.py")) | |
for path in paths: | |
filename = os.path.basename(path) | |
if filename == '__init__.py': | |
continue | |
name, ext = os.path.splitext(filename) | |
modules.append(imp.load_source(name, path)) | |
return modules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment