#pip install aiofile from aiofile import async_open async def main(): async with async_open('your_file.txt', 'a') as afp: await afp.write("Hello ") await afp.write("world")