MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / _load_module_from_path

Function _load_module_from_path

kernelbench/bench_kb.py:104–112  ·  view source on GitHub ↗

Dynamically load a Python module from a file path.

(path: Path, module_name: str)

Source from the content-addressed store, hash-verified

102# ---------------------------------------------------------------------------
103
104def _load_module_from_path(path: Path, module_name: str):
105 """Dynamically load a Python module from a file path."""
106 spec = importlib.util.spec_from_file_location(module_name, str(path))
107 if spec is None or spec.loader is None:
108 raise ImportError(f"Cannot load module from {path}")
109 mod = importlib.util.module_from_spec(spec)
110 sys.modules[module_name] = mod
111 spec.loader.exec_module(mod)
112 return mod
113
114
115def load_reference():

Callers 2

load_referenceFunction · 0.85
load_kernelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected