def import_module(cls, file_name: str) -> ModuleType:
cwd = os.getcwd()
file_path = '{}/{}'.format(os.path.realpath(cwd), file_name)
spec = importlib.util.spec_from_file_location(file_name, file_path) # type: Any
module_import = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module_import)
return module_import
评论列表
文章目录