Skip to content

Commit 23c06a5

Browse files
committed
use 'scripts.' prefix for names of dynamically loaded modules
1 parent badb70d commit 23c06a5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

modules/script_loading.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
from modules import errors
55
import sys
66

7+
8+
loaded_scripts = {}
9+
10+
711
def load_module(path):
812
module_spec = importlib.util.spec_from_file_location(os.path.basename(path), path)
913
module = importlib.util.module_from_spec(module_spec)
1014
module_spec.loader.exec_module(module)
11-
if os.path.isfile(path):
12-
sp = os.path.splitext(path)
13-
module_name = sp[0]
14-
else:
15-
module_name = os.path.basename(path)
16-
sys.modules[module_name] = module
15+
16+
loaded_scripts[path] = module
17+
18+
module_name, _ = os.path.splitext(os.path.basename(path))
19+
sys.modules["scripts." + module_name] = module
20+
1721
return module
1822

1923

0 commit comments

Comments
 (0)