Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.





Start a python script on the selected target. The script should be copied to the target before running the command. The script and log paths should be absolute (relative paths are not supported).

The script output can be monitored using the OpalDisplay or by the OpalDisplayInformation() Api command. See the OpalDisplayInformation documentation for more details.

The function EnableContinousScriptDisplay() can be called at the beginning of the Python script to enable continuous display during execution. If this command is not called, the script standard output will be displayed only at the end of the execution.

Required Control

The API should be connected to a model before running the command.


RtlabApi.StartTargetPythonScript(targeName, targetAbsoluteScriptPath, args hostLogPathName)


  • targetName: Target name where the script will be executed.

  • targetAbsoluteScriptPath: Full Path and name of the python script.

  • args: Script Arguments. This value can be set to NULL.

  • hostLogPathName: Full Path and name of the script log file on the host. This value can be set to NULL to disable logging. The standard output of the script will be written in this file.




  • EOK: Success.

  • EFAULT: Invalid parameter.

  • ENOEXEC: Python interpreter is not found on the target or the script path does not exist.

  • EINVAL: Python script file does not exist.

  • EBADF: Model not specified by previous Connect or OpenProject.

  • OP_API_EMODEL_RESPONDING: The target is down.

  • EIO: Error sending the request or receiving the reply.


See example start_target_python_script

Related Items



import RtlabApi


OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323