skip to Main Content

I want to know, is there any way to debug user-written modules, if they are used in Jupyter notebook, using VSCode?

I want it to work so that if I create a breakpoint in my module and when I call some function from this module in Jupyter notebook, it will stop and allow me to see some useful data. Default VSCode debugger works this way only if breakpoint is set in the file that I run.

I tried to set breakpoints (like function or red dot on the left from the code) in module, but calling function with it from notebook doesn’t trigger it.

2

Answers


  1. Chosen as BEST ANSWER

    I got answer, that is OK to me. In VSCode I can export notebook as Python script enter image description here

    and then I can write breakpoint() in necessary place in my module. If I run the exported Python script, then breakpoint activates and I can see all values. Anyway, thanks to everybody for help.


  2. You can add import pdb; pdb.set_trace() from python pdb to add a breakpoint in your code.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search