Set Breakpoint / Debug module outside of current project

Hello -

I'm debugging some code that makes use of an API wrapper that somebody wrote that is not part of the package that I'm actually debugging (It's in an entirely different parent directory) and I want to be able to put a breakpoint on / debug this 'external package' so that I can inspect the variables in memory at run time.

To Clarify:  Pycharm highlights the import statement for the API wrapper as invalid because it is not part of the project.  However, the code will still run because the path to the API wrapper has been added to the PYTHONPATH environment variable on the Operating system.  All of this was put together by another person a long time ago, is 'productionalized' and is not under and sort of VC, so I need to tread very lightly as far as suggestions to 'just don't do it that way' might go.

With this in mind, is there a way that I can put a breakpoint in the package 'referred to' by the package I'm debugging, then run the code from the main 'referring' program and debug?


Have you tried setting a breakpoint in a module of that external package?
You can just drag'n'drop the file to PyCharm, set a breakpoint, and debug your main package. It should hit that breakpoint when reached.


You need to add the directory of the external project to the PYTHONPATH of Pycharm. Then it'll stop at the breakpoints you set there.

See here how to do that:


Please sign in to leave a comment.