Share a script and use a template¶
Goal: make a script from a library template with your values bound, share it on the context so everyone there can run it, and (admins) lock or hide it.
Prerequisites
- Signed in. Anyone signed in may share scripts and change unlocked ones; locking, hiding and marking templates is for admins.
- The context to share on is active (a shared script belongs to one context).
Steps¶
- Open Infra > Scripts (route
/infra/scripts). - Pick a template: a script under Library (read-only), e.g. Deploy an indicator set, or a shared script with the template mark. Open it and read its code and form.
-
Use template… asks for the new script's name (a letter, then letters, digits or
_) and the template's form, once. Fill in what this script should always start with, e.g. the pairs and the candle interval, then Create.
The new script opens unsaved (Not saved · from indicator-set@<version>), with the values shown as bound. Copy instead makes a plain copy without bound values. 4. Share it: it is saved on the context and listed under Shared on
<context>for everyone there, in the web app and the TUI. (Save keeps it in this browser, under Mine.) 5. Admins: tick Locked (only admins change or delete it), Hidden (only admins see it) or Template (others may use it as a template), then Save. The list shows a lock, an eye or a template mark.
-
Run on
<context>…: the form starts with the bound values. You may change them for this run, except a field the template fixes (x-fixed), which shows its value read-only. A library script that writes starts as a dry run (Only show what would be deployed): untick it to apply.
What you should see¶
- The shared script under Shared on
<context>, with saved by<you>and the time, on every browser and in the TUI's scripts pane; its save in Infra > Changes. - A user who is no admin sees a locked script read-only (Locked: only admins change it) and never sees a hidden one.
- A shared Python script has a Runs tab: admins deploy it there as a worker, to run on a schedule, on events or on demand without a browser (Deploy a script as a worker).
Hidden is not secret
Hiding keeps a script out of the clients' lists for users who are no admins. Anyone with an
API key for the context can still read cfg.script.hidden.* from the gateway until the
platform restricts API keys. Never put a credential in a script: read it with
await vf.secret(name) (Scripts).
Troubleshooting¶
| Symptom | Cause and fix |
|---|---|
| the script X is locked: only admins change it | An admin locked it. Copy it, change the copy and share it under another name. |
| only admins lock, unlock, hide or unhide a script | Lock and hide are for admins; leave them as they are. |
| A shared script X exists. Replace it? | The name is taken on the context: say no and pick another, or yes to replace it (if it is not locked). |
| A name is a letter, then letters, digits or _ | Rename it, e.g. WEEKLY_CHECK, not weekly-check. |
| A strict field says options are loading | Its choices are still being read from an operation: wait a moment, then run. |
Reference: Scripts, Shared scripts,
Templates, the /scripts route.