From 2fea0875923aad02481d343f114c15f72a7345ef Mon Sep 17 00:00:00 2001 From: limbicnation Date: Fri, 1 May 2026 04:19:16 +0200 Subject: [PATCH] fix: use relative import for style_presets in StyleApplier The absolute `from style_presets import StylePreset` failed at INPUT_TYPES() evaluation because ComfyUI's loader does not reliably place the custom-node directory on sys.path. Switch to `from ..style_presets import StylePreset` with an absolute fallback for test/script-execution contexts, matching the dual-mode try/except pattern already used in __init__.py. Co-Authored-By: Claude Opus 4.7 --- nodes/style_applier_node.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nodes/style_applier_node.py b/nodes/style_applier_node.py index d6e3a07..a588fc8 100644 --- a/nodes/style_applier_node.py +++ b/nodes/style_applier_node.py @@ -25,7 +25,10 @@ class StyleApplierNode: @classmethod def INPUT_TYPES(cls): """Define input parameters for the node.""" - from style_presets import StylePreset + try: + from ..style_presets import StylePreset + except ImportError: + from style_presets import StylePreset return { "required": { @@ -66,7 +69,10 @@ class StyleApplierNode: include_technical: bool = True, ) -> tuple[str, str]: """Apply style keywords to a prompt.""" - from style_presets import StylePreset + try: + from ..style_presets import StylePreset + except ImportError: + from style_presets import StylePreset # Normalize inputs prompt = prompt.strip() if prompt else ""