12 lines
347 B
Python
12 lines
347 B
Python
from importlib import import_module
|
|
|
|
def globalImport(glob, namespace, childrens=None):
|
|
if childrens is None:
|
|
glob[namespace] = import_module(namespace)
|
|
return
|
|
elif isinstance(childrens, str):
|
|
childrens = [childrens]
|
|
module = import_module(namespace)
|
|
for c in childrens:
|
|
glob[c] = getattr(module,c)
|