Skip to content

Commit

Permalink
Merge pull request #15532 from huchenlei/fix_module
Browse files Browse the repository at this point in the history
Fix cls.__module__ value in extension script
  • Loading branch information
AUTOMATIC1111 authored Apr 21, 2024
2 parents 9bcfb92 + a95326b commit c0eaeb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extensions-builtin/hypertile/scripts/hypertile_xyz.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from modules import scripts
from modules.shared import opts

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

def int_applier(value_name:str, min_range:int = -1, max_range:int = -1):
"""
Expand Down
10 changes: 4 additions & 6 deletions modules/script_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@


def load_module(path):
module_spec = importlib.util.spec_from_file_location(os.path.basename(path), path)
module_name, _ = os.path.splitext(os.path.basename(path))
full_module_name = "scripts." + module_name
module_spec = importlib.util.spec_from_file_location(full_module_name, path)
module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(module)

loaded_scripts[path] = module

module_name, _ = os.path.splitext(os.path.basename(path))
sys.modules["scripts." + module_name] = module

sys.modules[full_module_name] = module
return module


Expand Down

0 comments on commit c0eaeb1

Please sign in to comment.