๐ฅ๐ ฐ๏ธ Load Global Variables
Reuse named values across workflows
- connect_to_workflow
- variables
If you've ever wanted to define something once - a character description, a quality-tag block, a trigger word - and reuse it across a dozen nodes without wiring the same string everywhere, this is that. Load Global Variables reads a set of named variables from a file on disk so any workflow can pull them in. It's the "read" half of a save/load pair, and it's the closest the pack gets to a shared config you edit in one place.
The problem it solves
ComfyUI has no global state. Every value lives in a node, and if you want the same text in five spots you copy it five times - then change your mind and hunt down all five. Bjornulf's variable system fixes that with a plain text file. The companion Save Global Variables node appends or overwrites entries in ComfyUI/Bjornulf/GlobalVariables.txt, and this node loads them back out. Define your "hero character" once, reference it by name in every workflow that needs it, edit the file when the character changes, done. Because it's just a text file you can also crack it open and edit it by hand - no node required.
This pairs naturally with the pack's variable syntax elsewhere. The Advanced Write Text and Line Selector nodes understand <name>-style variable references, so a variable loaded here can be substituted into prompts downstream rather than pasted literally.
How it works
The node reads the variables file and returns its contents. The inputs:
- seed - an INT (default -1). This isn't a random seed in the image sense; it's the pack's standard "force a re-run" lever. Because ComfyUI caches nodes whose inputs didn't change, a loader reading a file can go stale - bump or randomize the seed and the node re-reads the file so edits you made outside ComfyUI actually get picked up.
- filename (optional) - a specific variable file to load. The pack added per-file variable sets, so you can keep separate files (say, one per project) instead of everything in the one default file.
- file_list (optional) - a dropdown of available variable files, defaulting to
default. - connect_to_workflow (optional) - a wildcard passthrough input. It doesn't change the output; it lets you slot the node into an execution chain so it runs at the right moment relative to everything else, which matters when you're loading values that were just saved earlier in the same graph.
The output is variables, a STRING carrying the loaded content. Feed it into whatever consumes it - a prompt, a Show node, a text combiner.
Installing the pack
All in one: ComfyUI Manager โ Install Custom Nodes โ search Bjornulf_custom_nodes โ install โ restart, or
cd ComfyUI/custom_nodes
git clone https://github.com/justUmen/Bjornulf_custom_nodes
Restart and it's under Bjornulf. No dependencies - it reads a text file.
Common issues
The classic one is staleness: you edit GlobalVariables.txt (or save new values with the Save node) and this loader keeps returning the old contents because ComfyUI cached it. Change the seed to force a fresh read - that's what it's there for.
The second is ordering within a single run. If you save variables and load them in the same workflow, ComfyUI's execution order isn't guaranteed to run the save before the load unless you make it so - that's exactly what connect_to_workflow is for, chaining the load after the save. And heads-up: the pack reworked the global-variable system once (adding the per-file filename), which was a breaking change, so a very old saved workflow may need its variable nodes rebuilt. Fresh setups are fine - save on one side, load on the other, bump the seed when you edit the file by hand.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | -1-1โ9223372036854776000 | โ |
| filenameopt | STRING | โ | |
| file_listopt | COMBO | default | 1 options: default |
| connect_to_workflowopt | * | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| variables | STRING | โ |