from contextvars import ContextVar import asyncio user: ContextVar[str] = ContextVar('user') async def who(): return user.get() async def main(): user.set('ada') print(await who()) asyncio.run(main())