Created
June 25, 2012 10:48
-
-
Save kmike/2987909 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
parent_module = None | |
for index, module_name in enumerate(mod_list): | |
full_name = '.'.join(mod_list[:index]) | |
module = sys.modules.setdefault(full_name, types.ModuleType(module_name)) | |
if parent_module: | |
setattr(parent_module, module_name, module) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment