Add module to sys.modules after loading for use with @dataclass

(cherry picked from commit a9ff0e80a37acacc814e15d88f4d40e5b6f95e7d)
This commit is contained in:
Will Lucas 2024-10-06 17:54:49 -05:00
parent 0b99d06f23
commit 41e98265d5

View File

@ -145,6 +145,7 @@ async def load_module_from_path(module_name, module_path):
# Load the module
spec = importlib.util.spec_from_file_location(module_name, module_path)
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
print(f"Loaded module: {module.__name__}")
if hasattr(module, "Pipeline"):