Skip to main content

Debugging VStitcher Python plugins

The purpose of this document is to explain how to debug a VStitcher/Lotta Python plugin with Visual Studio Code.

Updated this week

Prerequisites

  • VStitcher or Lotta 2025.2.1 or newer installed

  • Visual Studio Code installed

  • You have a working plugin that you would like to debug

  • You have added the plugin to VStitcher or Lotta (Please add only the plugin you want to debug)

Step One - Install debugpy Library

Open terminal and run the following command:

Windows:

cd {YOUR PLUGIN FOLDER - where plugin.json is located} "%programfiles%\Browzwear\VStitcher\2025.2\python\bin\python.exe" -m pip install debugpy -t ./lib

Mac:

cd {YOUR PLUGIN FOLDER - where plugin.json is located} "/Applications/Browzwear/VStitcher 2025.2.app/Contents/Resources/python/bin/python3.9" -m pip install debugpy -t ./lib

debugpy is downloaded to your {plugin source folder}/lib

Step Two - Prepare Visual Studio Code

First, create the launch.json configuration file as described here: https://code.visualstudio.com/docs/python/debugging#_initialize-configurations

Then, enter the following in the launch.json file.

{
"version": "0.2.0",
"configurations": [{
"name": "Debug BW Plugin",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
}
}]
}

Step Three - Modify the Plugin Code

To debug the plugin, you need to change it so it will use debugpy.

  1. Add the plugin folder to Visual Studio Code.

  2. Within your BwApiPluginInit implementation add the following code:

    # add the lib folder to sys.path 
    import os
    import sys
    sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
    import debugpy
    # 5678 is the default attach port in the VS Code debug configurations. Unless a host and port are specified, host defaults to 127.0.0.1
    # for further information see https://code.visualstudio.com/docs/python/debugging#_debugging-by-attaching-over-a-network-connection
    if sys.platform == 'win32': debugpy.configure(python=os.path.join(sys.base_exec_prefix, 'bin', 'python.exe'))
    else: debugpy.configure(python=os.path.join(sys.base_exec_prefix, 'bin', 'python3.9'))

    debugpy.listen(5678)
    print("Waiting for debugger attach...")
    debugpy.wait_for_client()
    debugpy.breakpoint()
    print('Break on this line.')

Step Four - Run VStitcher With Option to Debug Plugins

Run VStitcher with the --plugin-sandbox argument:

Windows:

"%programfiles%\Browzwear\VStitcher\2025.2\VStitcher.exe" 
--plugin-sandbox

Mac:

"/Applications/Browzwear/VStitcher 2025.2.app/Contents/MacOS/VStitcher" 
--plugin-sandbox

Note: It is better to run a development version - so you won’t have more plugins loaded

Step Five - Debug the Plugin

  1. Open VStitcher. VStitcher hangs and waits for the debugger to attach. (While the splash screen appears)

  2. Go back to Visual Studio Code and click the Debug tab.

  3. Click the green debug button next to Debug BW Plugin.

    The debugger should now connect to your plugin and stop at the debugpy.breakpoint line.

  4. Use Visual Studio Code to add breakpoints and debug your plugin.

Did this answer your question?