How to drop into REPL (Read, Eval, Print, Loop) from Python code

I frequently use this:

def interact():
    import code
    code.InteractiveConsole(locals=globals()).interact()

Leave a Comment