Skip to content

Commit fa4d363

Browse files
committed
Set __main__ path to ComfyUI's main.py
1 parent e53f61c commit fa4d363

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

comfyui_to_python_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def add_comfyui_directory_to_sys_path() -> None:
6565
comfyui_path = find_path('ComfyUI')
6666
if comfyui_path is not None and os.path.isdir(comfyui_path):
6767
sys.path.append(comfyui_path)
68+
import __main__
69+
70+
if getattr(__main__, "__file__", None) is None:
71+
__main__.__file__ = os.path.join(comfyui_path, "main.py")
72+
6873
print(f"'{comfyui_path}' added to sys.path")
6974

7075

0 commit comments

Comments
 (0)