import telegram import asyncio bot_token = '5499662958:AAEAoWy0khLJMf238ZwvvEoBV1FKfaVF6S0' chat_id = '-618629809' async def send(chat_id,document_path,bot_token): # Create an instance of the bot bot = telegram.Bot(token=bot_token) a = open(document_path,'rb') await bot.send_document(chat_id=chat_id,document=a) class SendToTele(): def __init__(self,document_path,chat_id=chat_id,bot_token=bot_token): print("Sending to tele") asyncio.run(send(chat_id,document_path,bot_token)) print("Sended To Tele")