File size: 543 Bytes
e13f1f7
fce27c6
e13f1f7
31a88f8
fce27c6
 
 
 
 
 
 
e13f1f7
fce27c6
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import importlib.util
from pathlib import Path

def load_secure_memory_module(temp_path = "./modules/secure_memory.py"):
    """
    Dynamically loads secure_memory.py from a temporary path.
    Returns the module object.
    """
    secure_memory = Path(temp_path)
    if not secure_memory.exists():
        raise FileNotFoundError(f"{temp_path} not found.")

    spec = importlib.util.spec_from_file_location("secure_memory", temp_path)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module