Debugging functions in scripts when called by PyCharm's Jupyter Notebook editor


As per the title, when running interactively in the built in Jupyter Notebook editor in PyCharm, is it possible to set breakpoints in external modules contained in separate .py files?.

You can attach the debugger to the interactive python console and set breakpoints in modules that are imported, but it doesn't seem to work the same when using the PyCharm Jupyter Notebook editor.

I'm wondering what I am missing.


Comment actions Permalink


>when running interactively in the built in Jupyter Notebook editor

Do you execute cells or run the cell content in the console? Not sure if I got it correctly. In general, PyCharm can't debug Jupyter Notebooks at the moment.

Comment actions Permalink

I'm not trying to debug the notebook itself.

I have the notebook running within PyCharm calling functions in separate .py files.

I want to set a breakpoint within the .py file. Then call the function from the Notebook and then have execution stop in the .py file, not the notebook.

I'm not running the cell content from the console. I'm running it from the actual open notebook.

Comment actions Permalink

I see, thank you for the clarification. The only way to do it now is to use Debug Server, please see the relevant docs:

Comment actions Permalink

Using  Jupyter Notebook within pyCharm is slow and experiemental.

I would like individual cell debugging feature while in scientific mode.

Ipython backend provide all the necessary API for this.

Spyder already implemented this feature I want.


Please sign in to leave a comment.