Q:

Python debugging by invoking the keyboardinput in a script

ys it possible to invoke the keyboard in a python script?
E.g. in MATLAB there is way to write
% A lot of code "A"
...
keyboard
% A lot of code "B"
...

in a script, so if you execute the script, it will halt at "keyboard" and you can go on in your MATLAB-shell with the workspace which was build up by code in "A".
Is there a similar command in Python?

A:

Take a look at the Python debugger; instead of keyboard you'd use:
import pdb; pdb.set_trace()

and the debugger stops execution and lets you investigate the state of your program.

