Search code examples
pythondebuggingpycharm

In PyCharm, how do I enable breakpoints that will activate in a file that is not the startup file?


I hope this a real simple one that I just missed. I am setting up a development environment for a python-driven web application, and I can't seem to get my breakpoints in files outside of the startup file to pause when the code runs past them.

I have set up the Configuration correctly, as far as I know. The application starts and runs correctly with what I have set. I am able to set a breakpoint inside the file that is specified in the Script path, and when I start Debug mode this breakpoint is hit. But, if I set one in a file that is outside of this file, they get passed and the code continues to run.

What would I need to do to activate breakpoints in any file in a project, whenever the execution runs over the breakpoint?


Solution

  • The item I was looking for was Attach to Local Process. This allows me to attach a debugger to any running process, and breakpoints will be hit whenever they are hit in running code once the debugger is attached to the right process.

    I found this by troubleshooting the many options in the toolbar. Sometimes it is just a matter of playing around with something until you find it yourself, or knowing the right words to search...

    https://www.jetbrains.com/help/pycharm/attaching-to-local-process.html