restart()

Client.restart()

Restart the Client.

This method will first call stop() and then start() in a row in order to restart a client using a single method.

Returns

Client – The restarted client itself.

Raises

ConnectionError – In case you try to restart a stopped Client.

Example

from pyrogram import Client

app = Client("my_account")
app.start()

...  # Call API methods

app.restart()

...  # Call other API methods

app.stop()