Skip to content

Instantly share code, notes, and snippets.

@ungood
Created December 27, 2013 22:28
Show Gist options
  • Save ungood/8153540 to your computer and use it in GitHub Desktop.
Save ungood/8153540 to your computer and use it in GitHub Desktop.
load modules in a package
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