Created
January 31, 2014 01:11
-
-
Save yuuichi-fujioka/8724804 to your computer and use it in GitHub Desktop.
Find and load submodules.
This file contains hidden or 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 pkgutil | |
def load_submodules(mod): | |
for (importer, name, ispkg) in pkgutil.iter_modules(path=mod.__path__, | |
prefix=mod.__name__ + '.'): | |
if not ispkg: | |
yield importer.find_module(name).load_module(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment