def send_updates(): p = Prices(prices_db) p.create_tab() current_date = datetime.today().strftime("%d-%m-%Y") day_before_current_date = datetime.today() - timedelta(1) day_before_current_date = day_before_current_date.strftime("%d-%m-%Y") message = p.check_price_change(day_before_current_date, current_date) if len(message) > 0: u = Users(users_db) u.create_tab() where_to_send = u.get_users_chatid_to_update() if len(where_to_send) > 0: where_to_send = [x[0] for x in where_to_send] for user_chat_id in where_to_send: send_message(user_chat_id, cheeze_token, message)