Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unable to run a Python module in a subprocess when `subProcess: true`

Open
#1,997 3 comments 3 reactions 2 assignees View on GitHub

@rchiodo is already working on this.

Since Feb 23, 2026.

Assessment

This issue has not been assessed yet.

Description

bug Fixed in next release

The following script executes a Python module in a subprocess.

# main.py
import subprocess
import sys

subprocess.run([sys.executable, "-m", "sub"])
# sub.py
print("Hello, world!")
// launch.json
{
    "version": "0.2.0",
    "configurations": [
    
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "subProcess": true,
        }
    ]
}

Running this in the debugger with "subProcess": true fails:

bash-3.2$  cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56894 -- /Users/pete/projects/subprocess_test/main.py 
No module named sub

Running it with "subProcess": false works as expected:

bash-3.2$  cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 57618 -- /Users/pete/projects/subprocess_test/main.py 
Hello, world!

OS: Darwin arm64 25.3.0
VSCode: 1.109.5 (Universal)
Python Debugger: 2025.18.0
Python: 3.14.2 (in a virtualenv)

Dominant language
Python
Stars
2.5k
Forks
202
Avg merge
5d 1h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/debugpy

All issues in microsoft/debugpy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.