$ python -m pdb my_script.py
We can set break points in the script itself so that you can inspect the variables and stuff at particular points. This is possible using the pdb.set_trace() method. Here is an example:
import pdb
def make_bread():
pdb.set_trace()
return "I don't have time"
print(make_bread())
Commands:
c: continue execution
w: shows the context of the current line it is executing.
a: print the argument list of the current function
s: Execute the current line and stop at the first possible occasion.
n: Continue execution until the next line in the current function is reached or it returns.