title: Call an async function in an normal function
body: <p>I'm pretty new to the asyncio for python 3.6</p>
  
  <p>So the thing is I have a class and I want to init some property in there.
  And one of the property is the return value from an async function.</p>
  
  <p>What's the best practice to do this?</p>
  
  <ol>
  <li><p>Call event_loop one time in the init function to get the return value?</p></li>
  <li><p>Make the __init__ function async? and run it in the event loop?</p></li>
  </ol>
  
  <p>Cheers!</p>
  
  UPDATE AGAIN:
  
  <p>Following is my code:</p>
  
  <pre><code>import asyncio
  import aioredis
  from datetime import datetime
  
  class C:
      def __init__(self):
          self.a = 1
          self.b = 2
          self.r = None
          asyncio.get_event_loop().run_until_complete(self._async_init())
  
      async def _async_init(self):
          # this is the property I want, which returns from an async function
          self.r = await aioredis.create_redis('redis://localhost:6379')
  
      async def heart_beat(self):
          while True:
              await self.r.publish('test_channel', datetime.now().__str__())
              await asyncio.sleep(10)
  
      def run(self):
          asyncio.get_event_loop().run_until_complete(self.heart_beat())
  
  c=C()
  c.run()
  </code></pre>