From afba842a33185670febb7a610f2277a6d03fe39e Mon Sep 17 00:00:00 2001 From: jessesep Date: Fri, 5 Dec 2025 01:50:39 +0100 Subject: [PATCH] Add trigger input to GetVariable for execution ordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GetVariable now has optional 'trigger' input - Connect SetVariable output to GetVariable trigger to ensure Set runs first - Returns None instead of error when variable not found (graceful handling) - Shows "NOT SET" in preview when variable missing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- __init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 01eb9df..aecac21 100644 --- a/__init__.py +++ b/__init__.py @@ -53,12 +53,19 @@ class SetVariable: class GetVariable: - """Retrieve data by variable name - shows preview on node""" + """Retrieve data by variable name - shows preview on node + + IMPORTANT: Connect the 'trigger' input to the SetVariable output to ensure + the variable is set before this node runs. + """ @classmethod def INPUT_TYPES(cls): return { "required": { "variable_name": ("STRING", {"default": "my_var"}), + }, + "optional": { + "trigger": ("*",), # Connect to SetVariable output to ensure execution order } } RETURN_TYPES = ("*",) @@ -67,10 +74,12 @@ class GetVariable: CATEGORY = "variables" OUTPUT_NODE = True - def get_var(self, variable_name): + def get_var(self, variable_name, trigger=None): + # trigger input is just for execution ordering, not used if variable_name not in _variable_storage: available = list(_variable_storage.keys()) - raise ValueError(f"Variable '{variable_name}' not found. Available: {available}") + preview = f"{variable_name} = NOT SET (available: {available})" + return {"ui": {"text": [preview]}, "result": (None,)} value = _variable_storage[variable_name] preview = get_preview_text(variable_name, value)