Skip to content

Run until complete in thread / nested event loops #341

Discussion options

You must be logged in to vote

Just in case someone reads this issue, this is the way. Thanks!

from anyio import run, from_thread

async def foo():
    print('Hello, world!')

async def main():
    with from_thread.start_blocking_portal() as portal:
        portal.call(foo)

run(main)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@davidbrochart
Comment options

@gschaffner
Comment options

Answer selected by graingert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #340 on July 09, 2021 15:41.