Пишу тг бота . Есть много меню с кнопкой внизу. Нужно чтобы возвращалось к предыдущему меню и в главное меню

Как правильно описать действие «назад» в телеграмм боте на Python? Есть много меню с кнопкой внизу. Нужно чтобы возвращалось к предыдущему меню и в главное меню как это сделать подскажите.

import telebot

from telebot import types


bot = telebot.TeleBot('токен')

@bot.message_handler(commands=['start'])
def start(message):
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    item1 = types.KeyboardButton(' Информация')
    item2 = types.KeyboardButton(' Выбрать год')
    item3 = types.KeyboardButton(' Разработчики')

    markup.add(item1, item2, item3)

    bot.send_message(message.chat.id, 'Добро пожаловать, {0.first_name}!\n <b>{1.first_name}</b>,ваш помошник.'
    .format(message.from_user, bot.get_me()), parse_mode='html', reply_markup=markup)

@bot.message_handler(content_types=['text'])
def bot_message(message):
    if message.chat.type == 'private':
        if message.text == ' Информация':
            bot.send_message(message.chat.id, ' Работа')
        elif message.text == ' Выбрать год':
            markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
            item1 = types.KeyboardButton('?')
            item2 = types.KeyboardButton('?')
            item3 = types.KeyboardButton('?')
            item4 = types.KeyboardButton('?')
            item5 = types.KeyboardButton('?')
            item6 = types.KeyboardButton('??')
            item7 = types.KeyboardButton('??')
            back = types.KeyboardButton('⬅️Назaд')
            markup.add(item1, item2, item3, item4, item5, item6, item7, back)
            bot.send_message(message.chat.id, ' Выбрать год', reply_markup=markup)
        elif message.text =='⬅️Назaд':
            markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
            item1 = types.KeyboardButton(' Информация')
            item2 = types.KeyboardButton(' Выбрать год')
            item3 = types.KeyboardButton(' Разработчики')

            markup.add(item1, item2, item3)
            bot.send_message(message.chat.id, '⬅️Назaд', reply_markup=markup)
        elif message.text == '?':
            markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
            item1 = types.KeyboardButton('1977')
            item2 = types.KeyboardButton('1978')
            item3 = types.KeyboardButton('1979')
            item4 = types.KeyboardButton('1980')
            item5 = types.KeyboardButton('1981')
            item6 = types.KeyboardButton('1982')
            item7 = types.KeyboardButton('1983')
            item8 = types.KeyboardButton('1984')
            item9 = types.KeyboardButton('1985')
            item10 = types.KeyboardButton('1986')
            item11 = types.KeyboardButton('1987')
            item12 = types.KeyboardButton('1988')
            item13 = types.KeyboardButton('1989')
            back = types.KeyboardButton('⬅Назад️')
            markup.add(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13,
                       back)
            bot.send_message(message.chat.id, '?', reply_markup=markup)
        elif message.text == '?':
            markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
            item1 = types.KeyboardButton('2000')
            item2 = types.KeyboardButton('2001')
            item3 = types.KeyboardButton('2002')
            item4 = types.KeyboardButton('2003')
            item5 = types.KeyboardButton('2004')
            item6 = types.KeyboardButton('2005')
            item7 = types.KeyboardButton('2006')
            item8 = types.KeyboardButton('2007')
            item9 = types.KeyboardButton('2008')
            item10 = types.KeyboardButton('2009')
            item11 = types.KeyboardButton('2010')
            item12 = types.KeyboardButton('2011')
            item13 = types.KeyboardButton('2012')
            back = types.KeyboardButton('⬅Назад️')
            markup.add(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13,
                       back)
            bot.send_message(message.chat.id, '?', reply_markup=markup)
bot.polling(none_stop=True)

Ответы (0 шт):