The modules implementing Open Simulator functionality (pmpy and pmio) are provided as true standalone Python modules which allows for easy integration of Open Simulator functionality into new workflows.
Open Simulator scripts can be started directly with Python, for example, using:
python my_script.py
The above image shows an example of a script execution from the command prompt.
python: command required to execute python scripts.C:.script_path: path were the script is saved.-m: command to execute the script for the given model.D:.model_path: path to the model.Temperature: Argument needed for the script. In this example the Temperature overlay is deleted from the model.
Note: In this case, the PYTHONPATH environment variable must be set so that Python can find the pmpy and pmio modules. You must ensure the PYTHONPATH environment variable is set to the current Petromod version you are using (for example: 2024 or 2026). The environment variable should point to the bin directory of the Petromod installation.

The above image shows the PYTHONPATH environment variable referencing Petromod 2026.1. Therefore, when you run Petromod open simulator scripts from the command prompt, Python will use Petromod 2026.1 by default. To change the Petromod version without changing the environment variable, you can use the command set PYTHONPATH, as follows:
With the PM_HOME environment variable set to the location of the Petromod installation, use:
On Windows:
set PYTHONPATH=%PM_HOME%\WIN64\bin;%PM_HOME%\scriptsThis option is useful to quickly change between versions. Otherwise, if using one version only, this can be set in the environment variables as described above.

The above example command sets the PYTHONPATH to the Petromod 2026.1 bin folder.
On Linux:
export PYTHONPATH=$PM_HOME/RHEL8-x86_64/bin:$PM_HOME/scripts
The variables pmpy.pm_model and pmpy.pm_project are set when the pmpy module is imported while executing the scripts, based on the presence of a -m <path-to-model> option in the script arguments.
Parent topic:Get started