async def sql_menu(message, page = 1):
global user_id
user_id = message.from_user.id
sqlite_connection = sq.connect('pizza.db')
cur = sqlite_connection.cursor()
pages_count_query = cur.execute(f"SELECT COUNT(*) FROM `menu`")
pages_count = int(pages_count_query.fetchone()[0])
sql_select_query = """SELECT * FROM menu WHERE page = ?"""
a = cur.execute(sql_select_query, (page,))
print(a)
for row in a:
goodpage = row[0]
name = row[2]
description = row[3]
price = row[4]
photo = row[1]
dict1 = { 'id' : goodpage, 'name': name, 'description': description, 'price' : price, 'photo': photo}
<b> goodlist = [dict1]</b>
sqlite_connection.commit()
cur.execute(f"UPDATE `menu` SET `page` = ? WHERE `page` = ?;", (page, message.chat.id))
sqlite_connection.commit()
buttons = types.InlineKeyboardMarkup()
left = int(page) - 1 if page != 1 else pages_count
right = int(page) + 1 if page != pages_count else 1
left_button = types.InlineKeyboardButton("←", callback_data=f'to {left}')
page_button = types.InlineKeyboardButton(f"{str(page)}/{str(pages_count)}", callback_data='_')
right_button = types.InlineKeyboardButton("→", callback_data=f'to {right}')
buy_button = types.InlineKeyboardButton("Добавить в корзину", callback_data='cart')
buttons.add(left_button, page_button, right_button)
buttons.add(buy_button)
mt = f'- Название:{name}\n \n- Описание: {description}\n \n - Цена: {price} рублей'
await bot.send_photo(message.chat.id, photo ,mt , reply_markup=buttons)
await bot.delete_message(message.chat.id, message.message_id)
------------------------------------
В данном случае как использовать список goodlist в другой функции