(name)
Import a module if necessary, otherwise return it from the list of already imported modules
Import a module if necessary, otherwise return it from the list of already imported modules
Import a module if necessary otherwise return it from the list of already imported modules
def import_module_from_string(name):
    """Import a module if necessary, otherwise return it from the list of already imported modules"""
    if name in sys.modules:
        return sys.modules[name]
    else:
        return importlib.import_module(name)
def import_module_from_string ( name ) : if name in sys . modules : return sys . modules [ name ] else : return importlib . import_module ( name )