title: When running .render() (from requests_html) in an asyncio event loop, I get the error 'This event loop is already running'
body: <p>I am building a Discord bot using discord.py which gets live football scores from ESPN. What I have so far is:  </p>
  
  <p>Bot.py:  </p>
  
  <pre><code>import discord, asyncio
  from Scores import GetScores
  
  client = discord.Client()
  
  @client.event
  async def on_message(message):
      if message.content.startswith("!scores"):
          Output = GetScores(message.content)
  
  # rest of code
  </code></pre>
  
  <p>Scores.py:  </p>
  
  <pre><code>from requests_html import HTMLSession
  
  def GetScores(Message):
      Link = "http://www.espn.co.uk/football/scoreboard"
  
      Session = HTMLSession()
      Response = Session.get(Link)
      Response.html.render()
  
  # rest of code  
  </code></pre>
  
  <p>So when the '!scores' command is sent in Discord, Bot.py will run the event loop and calls the 'GetScores' function from Scores.py.  </p>
  
  <p>The problem is, when <code>Response.html.render()</code> is run, it gives me the 'This event loop is already running' error. Full error from that point:  </p>
  
  <pre><code>    Response.html.render()
    File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\requests_html.py", line 572, in render
      self.session.browser  # Automatycally create a event loop and browser
    File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\requests_html.py", line 680, in browser
      self._browser = self.loop.run_until_complete(pyppeteer.launch(headless=True, args=['--no-sandbox']))
    File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 454, in run_until_complete
      self.run_forever()
    File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 408, in run_forever
      raise RuntimeError('This event loop is already running')
  RuntimeError: This event loop is already running  
  </code></pre>
  
  <p>From <a href="https://github.com/kennethreitz/requests-html/issues/140" rel="noreferrer">this GitHub issue</a> I have found that the code is not designed to be run in an existing event loop. However, I am wondering if there is a workaround in asyncio to allow this to run in this situation. I would much prefer I found a workaround rather than another solution/module, since I wrote the entire thing using this method before testing it within the Discord event loop, and finding out it doesn't work.  </p>
  
  <p>Any help will be greatly appreciated, thanks!</p>