{% extends "base.html" %} {% block title %}Scripts{% endblock %} {% block content %}
A live Python interpreter sharing the same
namespace as the batch runner below — sensors,
turnouts, InstanceManager, all preloaded.
Type an expression to see its value; assign a variable and it
survives across submissions. Click Reset to start over.
Scripts run on a worker thread. The shim exposes
JMRI-style globals: sensors, turnouts,
lights, memories, powermanager,
plus ACTIVE, CLOSED, ON etc.
Define class X(AbstractAutomaton) to use the loop pattern.
Tick "Save to profile library" to persist the script to
<profile>/python/<name>.py so it autoloads
the next time the server starts.
Debug loop: any script with a "saved" badge
in the Running scripts table below gets a Run /
Re-run button that re-reads the file fresh from
disk each click — edit the file externally, click Run, watch output.
Files dropped into <profile>/python/ while the
server is up appear here after any list refresh.
Startup autoload opt-outs (three ways to keep
a script on disk + runnable but skip startup):
· rename to _name.py (private, also hidden
from Python imports)
· rename to lib_name.py (importable helper
module, not autoexecuted)
· add # jmri-autoload: false anywhere in
the first 20 lines (visible + runnable, just not at startup).