title: how to run pyrogram userbot with multiple user accounts using thread
body: <p>I am coding a userbot in pyrogram but I want to run multiple Clients with different telegram account but I am stuck here.
  I want to run userbot on multiple accounts using one script if I will run it separately then I have to host it so many time I want to host it for one time and run for every account I have.<br>
  I think this will help to understand what I am saying.</p>
  <pre><code>
  from pyrogram import Client, filters, handlers, idle
  import threading
  from pyrogram.handlers import MessageHandler
  
  app1 = Client(
      session, api_hash, api_id)
  
  
  app2 = Client(session,
                api_hash, api_id)
  
  
  accounts = [app1, app2]
  
  
  async def handlngmessage(client, message):
      print(message)
      print(&quot;\nstarted &quot;)
      await client.send_message(&quot;me&quot;, &quot;recived&quot;)
  
  
  def runner(c):
      c.run()
  
  
  for ac in accounts:
      ac.add_handler(handlers.MessageHandler(unmutedtest))
      t = threading.Thread(target=runner, args=(ac,))
      t.start()
      t.join()
  
  </code></pre>
  <p>When I run this I am just getting error</p>
  <p><strong>Output</strong>:</p>
  <pre><code>Exception in thread Thread-1:
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.9/threading.py&quot;, line 954, in _bootstrap_inner
      self.run()
    File &quot;/usr/lib/python3.9/threading.py&quot;, line 892, in run
      self._target(*self._args, **self._kwargs)
    File &quot;/home/ak/Desktop/development/bots/pyrogramplugins/userbot/main.py&quot;, line 30, in runner
      c.run()
    File &quot;/home/ak/.local/lib/python3.9/site-packages/pyrogram/methods/utilities/run.py&quot;, line 50, in run
      loop = asyncio.get_event_loop()
    File &quot;/usr/lib/python3.9/asyncio/events.py&quot;, line 642, in get_event_loop
      raise RuntimeError('There is no current event loop in thread %r.'
  RuntimeError: There is no current event loop in thread 'Thread-1'.
  Exception in thread Thread-2:
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.9/threading.py&quot;, line 954, in _bootstrap_inner
      self.run()
    File &quot;/usr/lib/python3.9/threading.py&quot;, line 892, in run
      self._target(*self._args, **self._kwargs)
    File &quot;/home/ak/Desktop/development/bots/pyrogramplugins/userbot/main.py&quot;, line 30, in runner
      c.run()
    File &quot;/home/ak/.local/lib/python3.9/site-packages/pyrogram/methods/utilities/run.py&quot;, line 50, in run
      loop = asyncio.get_event_loop()
    File &quot;/usr/lib/python3.9/asyncio/events.py&quot;, line 642, in get_event_loop
      raise RuntimeError('There is no current event loop in thread %r.'
  RuntimeError: There is no current event loop in thread 'Thread-2'.
  </code></pre>