from pyrogram import Client
app1 = Client("first account")
app2 = Client("second account")
# You can either stack decorators ...
@app1.on_message()
@app2.on_message()
async def m_func(_, message):
pass
# ... or use multiple add_handler calls
app1.add_handler(MessageHandler(m_func))
app2.add_handler(MessageHandler(m_func))
# Then start all Clients and call idle() to keep them running
app1.start()
app2.start()
Client.idle()
app1.stop()
app2.stop()