title: How to run async coroutines from init, wait until it is complete
body: <p>I am connecting to aioredis from <code>__init__</code> (I do not want to move it out since this means I have to some extra major changes). How can I wait for aioredis connection <code>task</code> in below <code>__init__</code> example code and have it print <code>self.sub</code> and <code>self.pub</code> object? Currently it gives an error saying </p>
  
  <blockquote>
    <p>abc.py:42> exception=AttributeError("'S' object has no attribute
    'pub'")</p>
  </blockquote>
  
  <p>I do see redis connections created and coro <code>create_connetion</code> done.</p>
  
  <p>Is there a way to call blocking asyncio calls from <code>__init__</code>. If I replace <code>asyncio.wait</code> with <code>asyncio.run_until_complete</code> I get an error that roughly says </p>
  
  <blockquote>
    <p>loop is already running.</p>
  </blockquote>
  
  <p><code>asyncio.gather</code> is </p>
  
  <pre><code>import sys, json
  from addict import Dict
  import asyncio
  import aioredis
  
  class S():
      def __init__(self, opts):
          print(asyncio.Task.all_tasks())
          task = asyncio.wait(asyncio.create_task(self.create_connection()), return_when="ALL_COMPLETED")
          print(asyncio.Task.all_tasks())
          print(task)
          print(self.pub, self.sub)
  
      async def receive_message(self, channel):
          while await channel.wait_message():
              message = await channel.get_json()
              await asyncio.create_task(self.callback_loop(Dict(json.loads(message))))
  
      async def run_s(self):
          asyncio.create_task(self.listen())
          async def callback_loop(msg):
              print(msg)
  
          self.callback_loop = callback_loop
  
      async def create_connection(self):
          self.pub = await aioredis.create_redis("redis://c8:7070/0", password="abc")
          self.sub = await aioredis.create_redis("redis://c8:7070/0", password="abc")
          self.db = await aioredis.create_redis("redis://c8:7070/0", password="abc")
          self.listener = await self.sub.subscribe(f"abc")
  
      async def listen(self):
          self.tsk = asyncio.ensure_future(self.receive_message(self.listener[0]))
          await self.tsk
  
  async def periodic(): #test function to show current tasks
      number = 5
      while True:
          await asyncio.sleep(number)
          print(asyncio.Task.all_tasks())
  
  async def main(opts):
      loop.create_task(periodic())
      s = S(opts)
      print(s.pub, s.sub)
      loop.create_task(s.run_s())
  
  if __name__ == "__main__":
      loop = asyncio.get_event_loop()
      main_task = loop.create_task(main(sys.argv[1:]))
      loop.run_forever() #I DONT WANT TO MOVE THIS UNLESS IT IS NECESSARY
  </code></pre>