title: How to make a multithreaded and async Python discord bot
body: <p><br />
  I'm making a discord bot, which uses some big data (500-900Mb).<br />
  My issue is that I need to refresh (getting from API) the data every minute and at the same time still answering to commands.</p>
  <p>For it I used the discord module discordpy and its discord.ext.tasks.loop object, but as you can imagine, that's not multithreaded and the bot is terribly lagging when getting data from API.</p>
  <p>To fix it I tried to use <code>asyncio.to_thread()</code> with <code>asyncio.gather()</code> but it doesn't works, my error is :</p>
  <p><code>RuntimeError: Cannot run the event loop while another loop is running</code>.<br />
  I'm stuck with this</p>
  <p>There is my problematic code:</p>
  <pre><code>def q():
      asyncio.run(getting_API_data)
  
  async def main():
      print(&quot;starting gather&quot;)
      await asyncio.gather(
          asyncio.to_thread(q),
          client.run(TOKEN)
      )
  asyncio.run(main())
  </code></pre>
  <p>Note that <code>getting_API_data</code> is an async function</p>