Nodes/ComfyUI-WBLESS/Get Global Variable
ComfyUI Node

Get Global Variable

Pull that stored value back — the other half of the variable pair

By LaoMaoBoss·Created about a year ago·Updated 5 days ago· 0
Get Global Variable
    • Output
    • variable data
    • scope
    variable_namenone

    This is the reader half of the pack's variable system. Its sibling, Set Global Variable, stores a value under a name anywhere in your workflow; this node retrieves it by that name and hands it to whatever needs it - no long wires across the canvas, no duplicating the same value in five places. If you've ever kept a "truth" (a seed, a model name, a prompt fragment) consistent across a big graph, this is the node that makes that trivial.

    It's also the friendlier half. The variable_name field pulls its suggestions from a dropdown of names that actually exist in the current session (the pack serves them via a /wbless/variables route), so instead of typing a name from memory and praying it matches, you pick from what's been stored. That single detail saves more typos than you'd expect.

    How it works

    Name it, get it back:

    • variable_name - the name you want to retrieve. Default "none" - if you haven't set anything, that's what you'll get back.
    • Output - a passthrough: whatever flows into the node's Input port comes out here unchanged, which lets you place this node inline in a data pipeline without breaking it.
    • variable data - the stored value itself, the thing you actually came for. It's typed *, so it carries images, strings, ints, whatever was stored.
    • scope - a COZY_SCOPE value for chaining Set/Get pairs in order, so you can control which variable wins when names overlap.

    Under the hood it reads from the same in-memory dictionary that Set Global Variable writes - the two nodes share one store, keyed by variable_name. No persistence between restarts, no files, no database. Just a session-scoped lookup table.

    Install

    Part of ComfyUI-WBLESS:

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

    restart ComfyUI, or install "ComfyUI-WBLESS" via ComfyUI Manager. No dependencies, no models.

    Troubleshooting

    The classic failure: the value reads as none even though you "definitely set it." Work backwards from three causes - the name doesn't exactly match (use the dropdown, not typing), the Set node hasn't run in this execution (variables are written when Set runs, and ComfyUI prunes or reorders nodes), or the session restarted (variables are in-memory and vanish). If you're retrieving inside a loop or after a cache hit, remember execution order matters more here than almost anywhere else. Pair it with Set Global Variable and you've replaced a tangle of shared wires with one named lookup - the kind of small quality-of-life win that keeps a big workflow editable.

    Category🌈WBLESS

    Inputs (1)

    NameTypeDefaultDescription
    variable_nameSTRINGnone

    Outputs (3)

    NameTypeDescription
    Output*
    variable data*
    scopeCOZY_SCOPE