Answer the question
In order to leave comments, you need to log in
Python. Pass variable to another function?
The code :
def func1(message):
markup = telebot.types.ReplyKeyboardMarkup(True)
markup.row('hello too')
send = bot.send_message(admin_id,'hello',reply_markup=markup)
bot.register_next_step_handler(message, func3)
def func3(message):
if message.text == 'hello too':
bot/send_message(chat_id=message.from_user.id, message_id=send.message_id, text = 'hail')
bot.delete_message(chat_id=admin_id, message_id=send.message_id)
Answer the question
In order to leave comments, you need to log in
This is probably what you want:
bot.register_next_step_handler(message, lambda msg: func3(send, msg))
...
def func3(send, message):
1. Return what you need from the first function
2. Write the result (what returns) of the 1st function to a variable
3. Pass the variable from p2 (the result of the first function) to the second as an argument
4. ?????
5. PROFIT!!!!111
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question