def get_module(name):
    try:
        return sys.modules[name]
    except KeyError:
        pass
    try:
        __import__(name)
    except ImportError as err:
        raise ModuleImportError("Error loading: %s (%s)." % (name, err))
    else:
        return sys.modules[name]
Use the Python import function to get a Python package module by name.
dataset/ETHPy150Open kdart/pycopia/aid/pycopia/module.py/get_module