Skip to content

Commit 24c5710

Browse files
authored
refactor: use exec_module instead of load_module
1 parent aebd669 commit 24c5710

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

virtool_workflow/runtime/discover.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ def import_module_from_file(module_name: str, path: Path) -> ModuleType:
8888
spec = spec_from_file_location(module_name, path)
8989
if spec is None:
9090
raise ImportError(f"could not import {path}")
91-
module = spec.loader.load_module(module_from_spec(spec).__name__)
91+
92+
module = module_from_spec(spec)
93+
if spec.loader is None:
94+
raise ImportError(f"could not load {path}")
95+
spec.loader.exec_module(module)
9296

9397
sys.path.remove(module_parent)
9498

0 commit comments

Comments
 (0)