Breakpoints in multiple modules
Is there a trick to setting breakpoints across modules? If I have a python file, a.py that imports b.py and I set a breakpoint in b.py when I run a.py the breakpoint does not fire for me. The code in b.py runs fine. Just the breakpoint isn't firing Is there a way to use the debugger here? What am I missing?
Thanks if you can help.
Can anyone confirm whether one can set breakpoints in a project with multiple modules?
mithrendal last edited by mithrendal
huh, nobody answers to you. Ok I will try. From what I have seen, only breakpoints of the script on which you started the debug-session will fire. That means if you debug a.py only those breakpoints will fire.
But what seems to work is some sort of multi-module or multiple script debugging. That means if you have your break in a.py then the debugger will perfectly step into b.py when you single step forward and the code leads into a method located in b.py
Thanks. At least I'm not crazy. This really limits the usefulness of the debugger. Sometimes the call chain can be complex and stepping to get to the code I need to look at isn't feasible. I might try a few more things and report back.
JonB last edited by
while not ideal, you can set breakpoints this way as well at the start of your main script:
and so on.
There is probably a way using objc to query all open editor files for breakpoints. An almost worked through way this would work: cycle through editor tabs
getting the filepath from .filePath()
checking for .editorView(), then
bps=tab.editorView().breakPoints() lines=[1+i for i,entry in enumerate(list(bps)) if entry['active'] ]
then add breakpoints as described above. This must happen after script is run, so either we pack this code into a
import filebreaks, or else we can hijack pythonista_preflight the way dgelessus does in his pythonista_startup to disable global clearing.