title: How to create an asyncio task that return value?
body: <p>I'm figuring out how to return a list[] in <code>asyncio</code>
  I know <code>asyncio.gather</code> could help me but there are so many ways I'm now confused.
  How Do I return value from main() ? Thank</p>
  <pre><code>async def wait_until(dt):
      # sleep until the specified datetime
      now = datetime.now()
      await asyncio.sleep((dt - now).total_seconds())
  
  async def run_at(dt, coro):
      await wait_until(dt)
      return await coro
  
  async def main():
      test=[]
      async for message in client.iter_messages(channel):
          test.append(message)
          return test
  
  
  loop = asyncio.get_event_loop()
  loop.create_task(run_at(datetime(2020, 12, 29, 19, 17),main()))
  loop.run_until_complete(asyncio.gather(*[main()]))
  # How to get test[] or How to pass it to another task?
  loop.run_forever()
  </code></pre>