Skip to content

Commit 0f82948

Browse files
committed
Fix cls.__module__
1 parent ff6f468 commit 0f82948

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

extensions-builtin/hypertile/scripts/hypertile_xyz.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from modules import scripts
22
from modules.shared import opts
33

4-
xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "xyz_grid.py"][0].module
4+
xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "scripts.xyz_grid"][0].module
55

66
def int_applier(value_name:str, min_range:int = -1, max_range:int = -1):
77
"""

modules/script_loading.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99

1010

1111
def load_module(path):
12-
module_spec = importlib.util.spec_from_file_location(os.path.basename(path), path)
12+
module_name, _ = os.path.splitext(os.path.basename(path))
13+
full_module_name = "scripts." + module_name
14+
module_spec = importlib.util.spec_from_file_location(full_module_name, path)
1315
module = importlib.util.module_from_spec(module_spec)
1416
module_spec.loader.exec_module(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-
17+
loaded_scripts[full_module_name] = module
18+
sys.modules[full_module_name] = module
2119
return module
2220

2321

0 commit comments

Comments
 (0)