Answer the question
In order to leave comments, you need to log in
How to run two asynchronous functions?
Maybe a stupid question, but I ask you to answer it. Just started learning asyncio Let
's say I have the following code:
async def test_1(message):
await print(message + " 2")
async def test_2(message):
await print(message)
await test_1(message)
test_2("Hello")
Answer the question
In order to leave comments, you need to log in
Print is not an asynchronous function. In your case, it might work like this:
import asyncio
async def test_1(message):
print(message + " 2")
async def test_2(message):
print(message)
await test_1(message)
asyncio.run(test_2("Привет!"))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question