Created
December 27, 2013 22:28
-
-
Save ungood/8153540 to your computer and use it in GitHub Desktop.
load modules in a package
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
def load_modules(package): | |
for importer, name, is_package in pkgutil.iter_modules([package]): | |
fullname = package + '.' + name | |
if not is_package: | |
loader = importer.find_module(fullname) | |
yield loader.load_module(fullname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment