Python Startup Script worksheet
- Last UpdatedOct 29, 2026
- 2 minute read
The Python Startup Script worksheet is a Python interface that is automatically executed when the project is run.
To open and edit the Startup Script worksheet:
-
In the Tasks tab of the Project Explorer, open the Script folder to access the VBScript and Python subfolders. Open the appropriate Script subfolder, VBScript or Python, and either double-click the Startup Script or right-click it and choose Open on the context menu. The script worksheet is opened in the Screen/Worksheet Editor.

-
Enter your code in the interface. For example:
# Initializing default values
HMI.Trace("Setting initial tag values...")
HMI.SetTagValue("Temp1_F", 35.7)
HMI.SetTagValue("Distance1_miles", 354)
HMI.SetTagValue("Distance2_inches", 5)
-
Save your changes.
Startup Script information and notes
-
The code configured in this worksheet is executed just once when the Background Task module (BGTask) is started. This interface is useful for initializing variables or executing logic that is implemented when the project is run.
Note: When a Tasks script worksheet or a Global Procedures script worksheet is saved during runtime (on-line configuration), the Startup Script will be executed again and the values of the local variables of any script worksheet will be reset.
-
Procedures declared in this interface are available to the other Script worksheets executed by the Background Task module. Procedures will not be listed under the worksheet in the Project Explorer as they are in the Global tab Procedures folder.
-
You can put a password on any of your scripting worksheets to prevent them from being edited or analyzed by other users. See Password-protecting files for more information.