How to: Execute a Python script from the CODESYS Linux SL runtime on a WAGO Edge Computer 752-94xx

This “How to” guide explains how to execute a Python script as an external process from a CODESYS application running on a WAGO Edge Computer 752-94xx. It assumes that the script is already installed on the computer along with the necessary packages.

  1. Modify the CODESYS Control Configuration File:
    • Access the Edge Computer via SSH using a program like PuTTY.
    • Edit the “/etc/CODESYSControl.cfg” file with a text editor such as Nano.
    • Add the following lines to permit the execution of external commands:

    • Save the file and exit the editor.
    • Restart the CODESYS runtime if it is already running.

  2. Open the CODESYS application and add the “SysProcess” library to the project.

  3. Call your Python script using the “SysProcess_Implementation.SysProcessExecuteCommand2” function block. For example:

2 Likes

one remark:
I would recommend to add this in:
/etc/codesyscontrol/CODESYSControl_Usr.cfg
this is new since 4.13.0.0 release (path changed)
and use the CODESYSControl_Usr.cfg - on an update of the runtime version the CODESYSControl.cfg will be overwriten the CODESYSControl_Usr.cfg stays untouched

2 Likes