For Python 3.13+, pdb supports multi-line input.
For Python <= 3.12, use IPython.
from IPython import embed; embed(user_ns=locals() | globals())