Nodes/ComfyUI-WBLESS/Set Global Variable
ComfyUI Node

Set Global Variable

Stash a value once, grab it anywhere in the graph

By LaoMaoBoss·Created about a year ago·Updated 5 days ago· 0
Set Global Variable
    • Output
    • scope
    variable_name

    You know the feeling: you have a value - a seed, a LoRA name, a working prompt fragment - that five different corners of a workflow need, and you're stringing wires across the whole canvas to share it. This node is the alternative. Give the value a name, and any Get Global Variable node in the session can pull it back out by that name. No more ten-foot connections, no more trying to find where you left that one wire.

    It's a genuinely useful utility, and it's worth being honest about the limits up front: variables live in memory for the ComfyUI session only. Restart ComfyUI and they're gone. It's not a persistence layer, it's an anti-tangle device for large graphs.

    How it works

    You give the node a variable_name and feed it a value. The README's framing is helpful here - the variable data input is where the value you want to store goes in, and the Input/Output pair forms a passthrough pipeline so you can chain these nodes in sequence without breaking your data flow. Under the hood it's simpler than the marketing: a class-level dictionary, keyed by variable_name, written every time the node runs. Name it, store it, done.

    Two outputs come out: Output (the passthrough - whatever you put in Input comes out unchanged) and scope (a COZY_SCOPE value, which is the pack's way of letting you chain Set and Get nodes in order so you control which variable wins when names overlap).

    The input that matters

    • variable_name - pick a name you'll type identically in the matching Get node. That's the contract between the two halves.

    The node auto-suggests stored variable names in the Get node's dropdown via a small server route (/wbless/variables), which saves you from typo hell - but it only lists names that already exist in this session.

    Install

    Part of ComfyUI-WBLESS, which has zero extra dependencies and no model files:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LaoMaoBoss/ComfyUI-WBLESS
    

    restart ComfyUI, done. Or ComfyUI Manager, search "ComfyUI-WBLESS," install.

    Troubleshooting

    The classic failure is a variable that reads as empty - and nine times out of ten it's a name mismatch or execution order. The Set node has to actually run before the Get node, which matters more than you'd think in a graph where ComfyUI can prune or reorder nodes. If you store under seed_a and read from seed_a (trailing space), you'll get nothing back. And because everything resets on restart, a workflow that worked yesterday and "lost" its variable today is usually just a fresh session with no Set node run yet. Name it once, check the dropdown, and let the wires go.

    Category🌈WBLESS

    Inputs (1)

    NameTypeDefaultDescription
    variable_nameSTRING

    Outputs (2)

    NameTypeDescription
    Output*
    scopeCOZY_SCOPE