Scripts overview

QInsight has an integrated Python — scripts run directly inside the application and have direct access to the project variables. They are useful for automation (reacting to events, writing values) as well as for retrospective analysis of measured data.

Python setup

The application uses the Python installed on the computer (64-bit CPython 3.10 to 3.14, see Installation). Python is optional — it is enabled once in Options → Preferences → General:

  • Use Python scripts — enables Python in the application. When checked, Python Dll Path must be filled in and the file must exist, otherwise the settings cannot be saved.
  • Python Dll Path — the path to python3xx.dll in the Python installation folder (e.g. ...\Python313\python313.dll). With Python disabled the path is ignored but kept.

When Python is disabled, QInsight behaves at runtime start according to whether the project contains scripts and whether they are enabled (the Runtime column of the script; the Replay column when replaying a log):

Python in settingsScript in projectScript enabledRuntime start
enabledanyanystarts, enabled scripts run
disablednone—starts without a message
disabledpresentnostarts; a warning in Logs that the project contains Python scripts and Python is disabled
disabledpresentyesdoes not start; an error in Logs asking you to enable Python in Preferences

With several scripts in a project the strictest case applies: a single enabled script is enough to block the start; if all are disabled, the runtime runs and the warning is logged once.

The interactive console Tools → Interpreter → Python is available only with Python enabled; when disabled, the menu item is inactive regardless of the open project.

Scripts in the project

Scripts are managed in Home → Project Configuration → Scripts and are part of the project (saved with it as .py files). Each script has:

  • File name — the script file name,
  • Runtime — whether the script is used during regular communication,
  • Replay — whether it is also used while replaying a log,
  • Execution mode — when it runs:
    • Startup — once when the runtime starts,
    • Periodic — repeatedly; the period is given in Parameters, e.g. period=500;unit=ms,
    • OnValueChanged — when the value of a chosen variable changes (with a threshold, hysteresis…),
    • Shutdown — once when the runtime stops,
    • Manual — by hand,
  • Blocking and Timeout (ms) — the run style and limit,
  • Parameters — additional mode parameters.

📷 Image placeholder — script properties in Project Configuration.

Script output

Everything a script prints (print) goes to the Script-Logs window. Engine errors and warnings (e.g. an invalid period or an expired timeout) appear in the Logs window. If a periodic script takes longer than ~70 % of its period, the engine skips the next calls and warns — the period is therefore also the script's time budget.

Next

How a script reads and writes values — Accessing variables.