Created
September 11, 2018 15:59
-
-
Save alekratz/725c245089aa95494acfc1323c2191bd 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 glob | |
import importlib | |
from os.path import dirname, basename, isfile | |
import sys | |
import omnibot | |
modules = glob.glob(dirname(__file__) + "/*.py") | |
__all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.endswith("__init__.py")] | |
from . import * | |
__all__ = [] | |
for module_name, module in sys.modules.items(): | |
for typename, mod in module.__dict__.items(): | |
if isinstance(mod, omnibot.ModuleMeta): | |
loaded = importlib.import_module(module_name, typename) | |
globals()[typename] = loaded | |
__all__ += [typename] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment