config.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号