1

I need call async code from sync code which called from other async function

I try to do Setting a descriptor in python3.5 asynchronously but this answer didn't help me


async def first():
    return second()


def second():
    # TODO: In this function I want to call function thrird,
    #       and I want to call it asynchronous!
    #       This function MUST be syncronious (for example __get__)


async def third():
    await asyncio.sleep(1)


async def main():
    await asyncio.gather(
        first(),
        first()
    )
    # must work 1 second


asyncio.run(main())

This code must work 1 sec, not 2

Ktulhy-kun
  • 11
  • 4

0 Answers0