Similar to GDB, Python has a built-in debugger module that allows you to set breakpoints during execution.
import pdb
pdb.set_trace()
n
s
c
p
l