Telegramm Bot Carousel

def display_cart(self): # self это message
        try:
            global cart
            global counter
            counter = 0

            connection = db.create_connection(
                "merch_telegram_bot_db", "postgres", "password",
                "127.0.0.1",
                "5432"
            )
            query = q.interface_query[
                        'display_product_cart'] + str(self.from_user.id)
            cart = db.execution_of_requests(connection, query)
            connection.close()
            cart_keyboard = key.cart_keyboard()
            bot.send_message(self.chat.id, "Корзина:\n")
            bot.send_message(self.chat.id, f"{cart[0][0]}\n"
                                           f"{cart[0][1]}\n"
                                           f"<a href='{cart[0][2]}'>&#8203"
                                           f";</a>",
                             parse_mode="HTML",
                             reply_markup=cart_keyboard)

        except Exception as e:
            print('Фатальная ошибка!' + f'\n{str(e)}')
            return

    def callback_data_handler(self): # self это call (ответ inline кнопок)
        try:
            connection = db.create_connection(
                "merch_telegram_bot_db", "postgres", "password", "127.0.0.1",
                "5432"
            )
            id_element = extract_id(self.data)
            if id_element[0] == 'cat':
                query = q.interface_query['product'] + id_element[1]
                product = db.execution_of_requests(connection, query)
                bot.edit_message_text(chat_id=self.message.chat.id,
                                      message_id=self.message.message_id,
                                      text=f'{product[0][0]}')
                for i in product:
                    show_product_keyboard = key.show_product(i)
                    bot.send_photo(self.from_user.id, i[5],
                                   caption=f'\n{i[2]}\n{i[3]}',
                                   reply_markup=show_product_keyboard)
                bot.answer_callback_query(self.id, show_alert=False)
            elif id_element[0] == 'prod':
                query = q.interface_query['cart_id_info'] + \
                        str(self.from_user.id)
                cart_id = db.execution_of_requests(connection, query)
                query = q.interface_query['add_product_cart']
                data = (cart_id[0][0], id_element[1])
                db.execution_of_requests(connection, query, data)
                InterfaceInteraction.alert(self, "Товар добавлен в корзину")
            elif id_element[0] == 'delete':
                print("Ok_delete")
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'remove':
                print("Ok_remove")
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'add':
                print("Ok_add")
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'previous':
                print(self)
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'next':
                print(cart)
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'order':
                print("Ok_order")
                InterfaceInteraction.alert(self)
            elif id_element[0] == 'continue':
                print("Ok_continue")
                InterfaceInteraction.alert(self)
            else:
                InterfaceInteraction.alert(self)
            connection.close()
        except Exception as e:
            print('Фатальная ошибка!' + f'\n{str(e)}')
            return
Long Leopard