Skip to content
Advertisement

How to pass a variable to a different function (a different stage in ConversationHandler?)

So I have a bot which moves from stage to stage using the stage names as a product of return of each function. e.g.

JavaScript

So in the end() function I need to pass the variables from functions getfile() and get_info() in the some_function. But I have no clue how to do it, because returning multiple values doesn’t work for me and even if it worked, obviously I can’t call functions.

Advertisement

Answer

You could use global variables filename and info (maybe don’t name them that) that you rewrite within your functions. Just define them with some default value above your function definitions. Right now they’re just defined locally and disappear once the function returns.

Advertisement