Simcenter Amesim How can I launch a Python script from the Simcenter Amesim sketch?

Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share


You can run Python scripts from the Simcenter Amesim sketch using the submodel SCRCALL01. This option is available in Parameter and Simulation mode and with this knowledge base articles we provide a model showing how to launch a small video game based on the classical Snake one.


snake.ame (232 KB)
In order to be able to launch a Python script directly from the Simcenter Amesim sketch you can use the submodel SCRCALL01:
User-added image
This submodel allows you to launch the script from Parameter or Simulation mode. 
You will need to setup the the command interpreter AMEPython, which is the Python executable inside the Simcenter Amesim installation,  and route the command to the location, where the script is stored. In this case the script is located inside the UserData folder in the snake.ame model:
User-added image
To run the script, you need to right click on the component and launch it:
User-added image

The script attached to this model starts a small game based classical video game Snake:
User-added image

The controls of the snakes are programmed to work with the arrows in your keyboard
User-added image
Attached to this knowledge base article, you will find the Simcenter Amesim model with the game.

KB Article ID# KB000049955_EN_US



Associated Components

Amesim Automation Connect