Skip to content

Python System Debugging

Connor Jakubik edited this page Feb 14, 2026 · 3 revisions
Simulation Development Workflow → Python System Debugging

Up to date for Platform 0.44.2

Written by Connor Jakubik

Prerequisites:


Python System Debugging

As a first resort, log messages and other forms of output should be used to inspect your code. There are however some programming issues that require a real IDE-based debugger to sort out. In normal programming, the IDE can be started in debugging mode and the code immediately stops at breakpoints and freezes execution on demand. Space Teams Python Systems are run as separate processes, which means there is a special procedure necessary to enter a debugging session where you can examine both the Python code and C++ objects behind it.

Extra per-install/per-update setup steps for Python debugger

  1. Complete the C++ Developer Setup, as we will be using some tools from there.

  2. Navigate to <Install directory>/Compute_Server/externals

  3. Double click py-install-x64-windows.exe

    Screenshot 2026-02-13 170241
  4. Double click py-install-x64-windows.exe

    image
  5. Modify

    Screenshot 2026-02-13 170352
  6. No changes needed on this screen; Next

    Screenshot 2026-02-13 170358
  7. Check Download debugging symbols and Download debug binaries.

  8. Install

Setting up a simulation to be debugged

Python Systems are loaded and connected before the Lobby sim state is active. The Lobby sim state is the best time to attach a debugger to a Python System, as the Python interpreter can be waiting inside st.connect_to_sim() indefinitely during this state. This is also before the st.BeforeInit(function) and st.BeforeRuntime(function) functions has been run.

As of v0.44.2, the only ways to have the simulation not automatically continue from Lobby state are:

  1. Run the simulation from the Unreal Client and wait before clicking Start Simulation in the role selection window.
  2. Do your own sleep/waiting logic inside C++ or Python code.

Attaching to a Python System in the Visual Studio debugger

NOTE: Not VS Code; that would be a different process.

Once you have the simulation running (in Lobby state or later, such as Sync/Init/Runtime):

  1. Open Visual Studio to the <install dir>/Compute_Server folder as is explained in the C++ Developer Setup.

  2. Open the Debug tab at the top of the window.

    Screenshot 2026-02-13 174121
  3. Select Attach to Process...

    Screenshot 2026-02-13 174107
  4. Filter processes shown by typing python.exe in the top left field.

  5. There will be two processes for each Python System. You will probably need to expand the rightmost Command Line section of this window in order to see the name of the Python System.

  6. When you find the Python System you want to attach to, Select the version that has Type of Python, x64.

  7. For Python code debugging, ensure the Code Type is set to both Native and Python (native) code.

    WIP this may be slightly wrong; try Python (native) code and Python instead if you see issues.

    1. Mostly for core developers, but also if you have a reason to examine the C++ objects, instead maybe pick Native only.
  8. Attach

Now your debugger is attached to this Python System. Here are some ways to start debugging:

  • Find your python file with File->Open->File..., then add a breakpoint.
  • Press the pause button, change the active Thread to Main Thread, and examine the Call Stack. Sometimes, this may be outside of your viewable code.

Extra Tips

  1. In Visual Studio, you can have a debugger attached to as many processes as you wish. This means you can have breakpoints in C++ and a number of Python Systems simultaneously.

Clone this wiki locally