Pyobjects/Global Var Save
Write a value to disk so it survives a ComfyUI restart
- STRING
Everything else in LogicUtils' global-variable family lives in memory - set it, get it, remove it, all gone the moment ComfyUI restarts. This is the node that breaks that limit: it takes whatever's currently stored under a key in the in-memory store and writes it out to an actual JSON file on disk, at filepath. That value now survives restarts, server crashes, machine reboots - anything short of deleting the file.
That matters for anything you want to persist between sessions rather than just between runs in the same session: a running total that should keep climbing across days of use, a cached result expensive enough that you don't want to recompute it after every restart, a seed or config value you set once and want to stick around indefinitely. Pair it with GlobalVarLoadNode on the other end, and you've got a lightweight, file-backed key-value store built entirely out of ComfyUI nodes - no database, no external service, just a JSON file.
How it works
Notice there's no value input here - this node saves whatever's already sitting in the in-memory store under key, which means something like GlobalVarSetIfNotExistsNode needs to run first to actually put a value there. filepath (default my_global_var.json) is where it gets written; allow_missing controls whether the node tolerates the key not existing yet in the in-memory store, or treats that as an error. Unlike its siblings, this one's output is a plain STRING rather than the wildcard * - likely a confirmation or the path written, since there's no original value type to echo back once it's on its way to a file.
Inputs and outputs
- key (default
my_key) - which in-memory value to persist. Must already be set. - filepath (default
my_global_var.json) - where the JSON file lands. Relative paths resolve relative to wherever ComfyUI's process is running from, so use an absolute path if you want to be certain. - allow_missing (default
false) - settrueif you want a missing key to be tolerated rather than erroring.
Output is a STRING.
Installing ComfyUI-LogicUtils
ComfyUI Manager: Install Custom Nodes → search "ComfyUI-LogicUtils" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/aria1th/ComfyUI-LogicUtils
Restart ComfyUI. No dependencies.
Worth knowing
This node and GlobalVarLoadNode are the pair that give LogicUtils' otherwise ephemeral global variables real persistence - everything else in the family (Get, SetIfNotExists, Remove) forgets everything the instant ComfyUI restarts. Since the save reads from the in-memory store rather than taking a value directly, forgetting to set the key first (with SetIfNotExists or the plain set node) before saving is the most likely way this trips you up. This is part of aria1th's (AngelBottomless's) sparsely-documented LogicUtils pack - public commits stopped in January 2026 - so double-check filepath resolves where you expect on your setup rather than assuming; there's no changelog to confirm the exact path-resolution behavior.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | my_key | — |
| filepath | STRING | my_global_var.json | — |
| allow_missingopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |