Good evening everyone!

I continue to deal with the bot for telegrams and the following interesting question arose.

I want that when I press the button, I’m going to follow the text with another button. Ruins at startup, what did I do wrong, tell me, please? PS The file with constants made separate if that.

import config import telebot from telebot import types bot = telebot.TeleBot(config.token) @bot.message_handler(commands=['start']) def start(message): markup = telebot.types.InlineKeyboardMarkup(row_width=1) button = telebot.types.InlineKeyboardButton(text='Click', callback_data='add') markup.add(button) bot.send_message(chat_id=message.chat.id, text='Text',reply_markup=markup) @bot.callback_query_handler(func=lambda call: True) def query_handler(call): if call.data == 'add': key = types.InlineKeyboardButton(row_width=1) url = types.InlineKeyboardButton(text="URL", url="") key.add(url) bot.send_message(call.message.chat.id, 'Text', reply_markup=key) if __name__ == '__main__': bot.polling() 

    1 answer 1

    I apologize!

    In my own code I found a bunch of errors.

    1. key = types.InlineKeyboardMarkup ()
    2. Tab. If you see tab-related errors, then if you are a Sublime Text user, log in: View -> Indentation -> Convert Indentation to Tabs