I have two classes(frames) for Tkinter one class generates a user id variable by using api inside a bbutton command method now i want to use that into another class how can i do it i have defined that variable global but not working. my code is something like this
class login page(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
def button_function():
global user_id
user_id = some value i got from api response
button = tk.button(command = button_fucntion())
class destination_page(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
def another_button_function(user_id):
#i want that user_id value here
button_2 = tk.button(command = another_button_fucntion(user_id))