compose()

async hydrogram.compose()[source]

Run multiple clients at once.

This method can be used to run multiple clients at once and can be found directly in the hydrogram package.

If you want to run a single client, you can use Client’s bound method run().

Parameters:
  • clients (List of Client) – A list of client objects to run.

  • sequential (bool, optional) – Pass True to run clients sequentially. Defaults to False (run clients concurrently)

Example

import asyncio
from hydrogram import Client, compose


async def main():
    apps = [Client("account1"), Client("account2"), Client("account3")]

    ...

    await compose(apps)


asyncio.run(main())