Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Move comfy sys path insert to custom node loading. (#14459)

comfyanonymous5ef0092af943
diff --git a/nodes.py b/nodes.py
index 0b3fdab63..b1a663f4c 100644
--- a/nodes.py
+++ b/nodes.py
@@ -20,8 +20,6 @@ from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
-sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
-
import comfy.diffusers_load
import comfy.samplers
import comfy.sample
@@ -2299,6 +2297,9 @@ async def init_external_custom_nodes():
Returns:
None
"""
+ # TODO: remove at some point when custom nodes don't break.
+ sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
+
base_node_names = set(NODE_CLASS_MAPPINGS.keys())
node_paths = folder_paths.get_folder_paths("custom_nodes")
node_import_times = []