I want to make separated file for telegram bot every commands in python

812 Views Asked by At

pytelegrambotapii am making a telegram bot and i want to make every command in separated files i tried to do with this code

from run_start import *
@bot.message_handler(commands=['cmds'])
async def semd_command(message):
    await bot.reply_to(message,"Commands\n\nComing Soon")

how to attach 2 files pytelegrambotapi

in 1st line import is main file whare bot running

When i put that code in main file its working but when i put separated its not working please give me solution

This is my first code

import cmds

bot = AsyncTeleBot('token')

@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):  
    await bot.reply_to(message,"__Heya__!! boiiiii How was your day???")
    await bot.reply_to(message,"Now Send /cmds to check my commands")
asyncio.run(bot.polling())
1

There are 1 best solutions below

0
On

I hope these basic templates help: