To add to victorhcm’s answer, I came up with a little more graceful approach. If you just add this one liner import os, signal; os.kill(os.getpid(), signal.SIGTRAP), you can stop at the exact point of your interest. It works better than pressing Ctrl+c button with.
# a.py

def breakpoint():
    import os, signal
    os.kill(os.getpid(), signal.SIGTRAP)

# your code...
breakpoint()  # set a breakpoint
# your code...

Then gdb python and do the same thing.