1

I need to schedule and await coroutine in non-async function. That function will be run in async coroutine, and there will be already running event loop.

Like this: async -> sync -> async.

It can be easly scheduled in event loop by asyncio.create_task.

But can i somehow await it in that sync function?

Thank you.

2
  • 1
    You cannot do so, at least not in the same event loop. If you could await the async function, your sync function would block the event loop. Which means it wouldn't be able to execute the inner async function, and... you have a deadlock. Commented Jul 24, 2019 at 20:18
  • This link contains an answer to your question. Commented Jul 25, 2019 at 3:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.