Skip to content

Commit 4fa9d62

Browse files
committed
fix: ensure proper module loading via importlib
1 parent d7383f3 commit 4fa9d62

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

raito/core/routers/parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import sys
34
from importlib.util import module_from_spec, spec_from_file_location
45
from pathlib import Path
56
from typing import TYPE_CHECKING
@@ -46,7 +47,11 @@ def _load_module(cls, file_path: StrOrPath) -> object:
4647
raise ModuleNotFoundError(msg)
4748

4849
module = module_from_spec(spec)
50+
module.__name__ = spec.name
51+
module.__file__ = str(file_path)
52+
sys.modules[spec.name] = module
4953
spec.loader.exec_module(module)
54+
5055
return module
5156

5257
@classmethod

0 commit comments

Comments
 (0)