How to automate PLAXIS with Python using the subprocess module


Application PLAXIS 2D
PLAXIS 3D
Version PLAXIS 2D all versions
PLAXIS 3D all versions
Date created 25 March 2026
Date modified 25 March 2026
Original author Stefanos Papavasileiou - Technical Support Group
Keywords PLAXIS, Python, start, launch, Input, Output, subprocess, module, API

Introduction

Automating your geotechnical analyses with PLAXIS can significantly speed up your workflow, especially for parametric studies or complex projects. 
This article shows how to use a Python script and the subprocess module to launch and control PLAXIS without opening the application manually.

The main scope of this article is to explain how to use Python's subprocess module to start the PLAXIS application as a separate process in Windows OS. 
Once PLAXIS is running, you can connect to Input or Output using the plxscripting library to send commands, build models, run calculations, and extract results.

The Python script is divided into several parts, from launching the application to closing it down cleanly.

 

Python script - Example

The full Python script is provided as a compressed file (ZIP) at the end of this article. Below each part is explained in detail, so you can adjust it according to your preferences.

Import modules

As always at the beginning of a Python script it is advisable to add any general import operations. In the article we need to import the subprocess module (official Python documentation).

Part 0: Setting Constants

Before we start, it is important to define some key constants.

Variable Description
plx_input_path The full path to the Plaxis2DXInput.exe or Plaxis3DInput.exe on your machine. Make sure this is correct for your installation.
plx_input_port The port number for the API server. This can typically be any free port; 10000 is the default value.
plx_password The password for the server. You must replace 'YOUR_PASSWORD' with the secure password in PLAXIS. This password can be the same as the one in the ‘Configure remote scripting server’ window under Expert menu, from Input or Output.

Part 1: Launch PLAXIS Input

This is where we use the subprocess.Popen function to start the PLAXIS Input application. Here, we pass the aforementioned variables as arguments. Notice the command arguments required:

Part 2: Connect to the PLAXIS API 

Once PLAXIS is running, we need to establish a connection to the scripting server. This is done with the new_server function from the plxscripting.easy module.

Part 3: Main Python script for your PLAXIS Input automation

This is the core of your automation script. Here, you can script all the actions you would normally perform manually in the PLAXIS UI.

Part 4: Launch and Connect to PLAXIS Output

To analyse the results, you need to launch and connect to the PLAXIS Output program.

Part 5: Main Python script for your PLAXIS Output automation

With the connection to the Output program established, you can now add commands to extract results, create plots, or generate cross sections.

Part 6 & 7: Closing the PLAXIS Sessions

It is crucial to close the server sessions properly to release the PLAXIS license.

Part 8: Terminate the PLAXIS Application

Finally, plx.terminate() sends a command to the operating system to close the PLAXIS application that was started by subprocess.Popen function in the beginning. This ensures a clean shutdown of the entire process.

 

Downloads

See also