So I import a module:
from IPython.core.debugger import Pdb
Then I initiate an object for debugging:
ipdb = Pdb()
I define a function to test debug mode:
def f(a=1):
ipdb.set_trace()
print(a)
After I run the function:
f()
I am in the debug mode, in this mode, I can quit easily with q, however, after I type
interact
to get in the interactive mode(because in this mode I can input multiple line code rather than one line code to run more complicated functional codes)
I can't quit this mode unless I kill the whole Python Jupyter session(like kill the kernel), I have tried quit(),quit,q(),q,exit(),exit,ctrl+C and ctrl+D ,None of them work.
I checked the source code of the IPython.core.debugger module and didn't get helpful info.
Does anyone know how to get out of this interactive session?

launch binder' to get a remote session. If you do that and then follow your MRE, you can follow this particular answer, which led me Exiting interact mode in %%debug cell led me to here ...now exiting InteractiveConsole...and then I still needed to exit theipdb>level. I did that withq. So the trick is getting the special character from somewhere on your machine. ....