restart()¶
-
Client.restart()¶ Restart the Client.
This method will first call
stop()and thenstart()in a row in order to restart a client using a single method.- Parameters
block (
bool, optional) – Blocks the code execution until the client has been restarted. It is useful withblock=Falsein case you want to restart the own client within an handler in order not to cause a deadlock. Defaults to True.- 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()