Skip to content

Commit 9694b84

Browse files
committed
Don't alter sys.argv when imported
1 parent 26ed53e commit 9694b84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

comfyui_to_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def assemble_python_code(self, import_statements: set, special_functions_code: L
339339
argparse_code.append(f'parser.add_argument("--disable-metadata", action="store_true", help="Disables writing workflow metadata to the outputs")\n')
340340
argparse_code.append('''
341341
comfy_args = [sys.argv[0]]
342-
if "--" in sys.argv:
342+
if __name__ == "__main__" and "--" in sys.argv:
343343
idx = sys.argv.index("--")
344344
comfy_args += sys.argv[idx+1:]
345345
sys.argv = sys.argv[:idx]

0 commit comments

Comments
 (0)