-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy path__init__.py
33 lines (28 loc) · 1.06 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import importlib
import os
import folder_paths
# Define the path to the 'py' directory
py = os.path.join(
folder_paths.get_folder_paths("custom_nodes")[0], "comfyui-photoshop", "py"
)
# List of modules
node_list = ["nodePlugin", "nodeRemoteConnection"]
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
# Import each module from the 'py' directory
for module_name in node_list:
spec = importlib.util.spec_from_file_location(
module_name, os.path.join(py, f"{module_name}.py")
)
imported_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(imported_module)
NODE_CLASS_MAPPINGS.update(imported_module.NODE_CLASS_MAPPINGS)
NODE_DISPLAY_NAME_MAPPINGS.update(imported_module.NODE_DISPLAY_NAME_MAPPINGS)
# Import 'Backend' module
backend_spec = importlib.util.spec_from_file_location(
"Backend", os.path.join(py, "Backend.py")
)
backend_module = importlib.util.module_from_spec(backend_spec)
backend_spec.loader.exec_module(backend_module)
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
WEB_DIRECTORY = "js"