Runtime error: Event loop is running : <p>I get the following error when I call the function <code>send_message</code>.</p>

<pre><code>Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/home/joffe/Documents/discord/irc/ircbot.py", line 44, in get_message
    mydiscord.send_message(line[1])
  File "/home/joffe/Documents/discord/irc/mydiscord.py", line 37, in send_message
    client.loop.run_until_complete(client.send_message(SERVER,message))
  File "/usr/lib/python3.4/asyncio/base_events.py", line 331, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 296, in run_forever
    raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.
</code></pre>

<p>My function <code>send_message</code> takes a message and sends it to a discord channel.
The function is called from a function that is running in a thread. The client object is created in the main thread.</p>

<pre><code>def send_message(message):
    print(str.encode("Message to discord: " + message))

    client.loop.run_until_complete(client.send_message(SERVER,message))
</code></pre>
