def __ImportModule( module_name, asName=None ):
"""
Import a python module as needed into the global namespace. This can be accomplished
programatically and inside a method or class.
@param module_name : name of the module to load x.y.z
@return module : python module object that was loaded
"""
module = __import__(module_name)
for layer in module_name.split('.')[1:]:
module = getattr(module,layer)
if asName:
for x in range( len(inspect.stack()) ):
inspect.currentframe(x).f_globals[asName]=module
return module
评论列表
文章目录