V
V
ViktorFilatov2022-01-26 17:12:32
Python
ViktorFilatov, 2022-01-26 17:12:32

How can I pass information to another function?

How can I pass information to another function?
those. pass information from the text variable in the askwhatabout1 function to the asktime1 function?

@bot.message_handler(commands=['timer'])
def timer(message):
    user = message.chat.id
    bot.send_message(user, "Write here what u need to be reminded of")
    bot.register_next_step_handler(message, askwhatabout1)


def askwhatabout1(message):
    user = message.chat.id
    text = message.text
    bot.message_handler(message.chat.id, text)
    bot.send_message(user, text)
    bot.register_next_step_handler(message, asktime1)

def asktime1(message):

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Evseev, 2022-01-26
@ViktorFilatov

Good evening, you can pass it by specifying it in the arguments of the desired function, i.e. def asktime1(message, text):

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question