Storage (Python)
The scripting Python package exposes Storage, mirroring the JS-side Storage namespace. It provides a per-script persistent key-value store backed by UserDefaults, so Python and JS index scripts can share the same value when they read/write the same key.
By default each script's keys are isolated from other scripts. Pass shared=True to read/write the cross-script shared domain.
Methods
Storage.set(key, value, shared=False) -> bool
Persist value under key. value must be JSON-serializable (str, int, float, bool, None, list, dict and combinations). Returns True on success.
Storage.get(key, shared=False) -> Any | None
Read the value previously stored under key. Returns None if the key doesn't exist.
Storage.remove(key, shared=False) -> None
Delete the entry under key. No-op if the key doesn't exist.
Storage.contains(key, shared=False) -> bool
Whether the key exists in storage.
Storage.keys() -> list[str]
List all keys belonging to the current script (per-script namespace only — not the shared domain).
Storage.clear() -> None
Remove all per-script keys for the current script. Does not affect the shared domain or other scripts' data.
