Save named values for the current macro to use in later runs. All flows in the same run share Storage; ordinary variables are shared only by sequential PYTHON_CODE actions in one flow, including GROUP actions. Parallel flows have separate variables. Storage is not a messaging channel between processes.
Read one persisted value by key and optionally fall back to a default when the key is missing.
Syntax
Storage.get(key, default=None)
Parameters
Name
Description
keyAny
Key to look up.
Required · Positional or named
No default
defaultAny?
Fallback value returned when the key is missing.
Optional · Positional or named
Default:None
Returns
Any? — The stored value for that key, or the provided default.
Example
# Restore a persisted counter with a fallback default
run_count = Storage.get("run_count", 0)
Storage.set
Static Method
Save a value under a key, replacing any previous value. Supported types include Number, String, Boolean, Point, Region, list, tuple, dict, set, and None; collections may contain other collections.
Syntax
Storage.set(key, value)
Parameters
Name
Description
keyAny
Key to write.
Required · Positional or named
No default
valueAny?
Value to persist for that key.
Required · Positional or named
No default
Returns
None — No return value. Other Storage reads see the change immediately. Changes are saved to the device after 2 seconds without a new write and again when the macro and all background flows finish.
Example
# Persist values for the next macro run
Storage.set("run_count", 3)
Storage.set("last_point", Point(500, 900))
Storage.remove
Static Method
Remove one persisted entry and return the old value.
Syntax
Storage.remove(key)
Parameters
Name
Description
keyAny
Key to remove.
Required · Positional or named
No default
Returns
Any? — The removed value, or None when the key was missing.
Example
# Drop a persisted flag when it is no longer needed
old_flag = Storage.remove("boost_enabled")
Storage.contains
Static Method
Check whether a persisted key currently exists.
Syntax
Storage.contains(key)
Parameters
Name
Description
keyAny
Key to test.
Required · Positional or named
No default
Returns
Boolean — `True` when the key exists, otherwise `False`.
Example
# Guard logic based on persisted state
if Storage.contains("last_point"):
MacroPanel.notify("Saved point is ready")
Storage.keys
Static Method
Get all persisted keys as a list in insertion order.
# Read all persisted values for quick inspection
saved_values = Storage.values()
Storage.clear
Static Method
Remove every persisted entry for the current macro.
Syntax
Storage.clear()
Returns
None — No direct return value. The storage becomes empty.
Example
# Reset all persisted Storage values
Storage.clear()
Storage.to_dict
Static Method
Get the dictionary used by Storage in this run. All flows share it: adding, changing, or deleting its entries changes Storage immediately. These edits are saved after 2 seconds without a new write and again when the macro and all background flows finish.
Syntax
Storage.to_dict()
Returns
dict — The Storage dictionary itself, not a separate copy.
Example
# Read and update the full persisted storage dictionary
state = Storage.to_dict()
state["bonus"] = 5
MacroPanel.notify(str(state))