vxgmichel/aioconsole

[Question] How to do the equivalent of code.interact(dict(globals(), **locals()))?

NightMachinery opened this issue · 1 comments

[Question] How to do the equivalent of code.interact(dict(globals(), **locals()))?

It is not documented at the moment, but aioconsole.interact takes an argument called locals:

await aioconsole.interact(locals=dict(globals(), **locals()))

Demonstration:

import asyncio
import aioconsole

a = "i should appear in the interactive session"

asyncio.run(aioconsole.interact(locals=dict(globals(), **locals())))