Skip to content

Instantly share code, notes, and snippets.

import os
def import_all_from(module_name, globals_):
# Calling it with the globals_ module provides a hook into the
# module-level globals; otherwise we'd get the function's globals
# (which might be different).
module_split = module_name.split('.')
while '__init__' in module_split:
module_split.remove('__init__')
while '__main__' in module_split: