Answer the question
In order to leave comments, you need to log in
Is it possible to run a coroutine without blocking execution (asyncio)?
I apologize right away - I'm new to programming, so the question may be stupid.
Is it possible to run a coroutine/task without blocking further code execution?
For example:
import asyncio
condition = False
async def do_something_important():
#тут происходит что-то важное
async def main():
while True:
#здесь что-то происходит, что-то считается и в какой-то момент
#condition меняется на True
if condition:
#тут запускается do_something_important():
#и оставляет его работать "в фоне" не дожидаясь результатов
#здесь продолжается работа
asyncio.run(main())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question