Developing Python applications for MicroStation is even more productive when combined with Visual Studio Code's remote debugging capabilities. With just a few setup steps, you can attach the VS Code debugger and leverage the debugging tools while your script runs inside MicroStation.
For complete details and prerequisites, refer to the MicroStation Python API documentation, specifically the Debugging Python Applications section.
After completing the prerequisites outlined in Debugging Python Applications, follow the steps below to debug your MicroStation Python application.
1. Launch MicroStation 2026
Start MicroStation 2026 and open the design file you want to work with.
2. Open the Python Editor
Launch the Python Editor and load the following script.
C:\ProgramData\Bentley\PowerPlatformPython\Examples\Microstation\Misc\Debugging\VSCode\DebugPlaceLine.py
3. Open the Example Folder in Visual Studio Code
Launch Visual Studio Code and open the entire folder—not just the Python file. This step is critical because VS Code needs access to the workspace configuration required for remote debugging.
C:\ProgramData\Bentley\PowerPlatformPython\Examples\Microstation\Misc\Debugging\VSCode\
Tip: Be sure to open the folder itself. Opening only the script file may prevent the remote debugger configuration from working correctly.
4. Run the Script in MicroStation
Return to MicroStation and execute the DebugPlaceLine.py script from the Python Editor.
5. Attach the VS Code Debugger
Switch back to Visual Studio Code and:
i. Select Run and Debug from the Activity Bar.
ii. Choose Python: Remote Attach from the available debug configurations.
iii. Click on the Play button to Start the debugger.
VS Code will attach to the Python process running inside MicroStation.
6. Debug Your Code
Once attached, you can use the standard VS Code debugging features:
Python: Documentation | API Presentations | FAQs | GitHub | Samples | Wikis | Blogs