@staticmethod
def get_module_from_string(modulestring: str, exit_on_fail: bool=False) -> Optional[ModuleType]:
    '\n        Getting a module import\n        when your module is stored as a string in a variable\n        '
    try:
        return import_module(modulestring)
    except ModuleNotFoundError as e:
        if exit_on_fail:
            log.error(e)
            raise e
        return None
    except Exception as e:
        if exit_on_fail:
            log.error(e)
            raise e
        log.error('Module {} not found.\nError: {}', modulestring, e)
        return None
Getting a module import
when your module is stored as a string in a variable
@staticmethod
def get_module_from_string(modulestring: str, exit_on_fail: bool=False) -> Optional[ModuleType]:
    '\n        Getting a module import\n        when your module is stored as a string in a variable\n        '
    try:
        return import_module(modulestring)
    except ModuleNotFoundError as e:
        if exit_on_fail:
            log.error(e)
            raise e
        return None
    except Exception as e:
        if exit_on_fail:
            log.error(e)
            raise e
        log.error('Module {} not found.\nError: {}', modulestring, e)
        return None