How do I pass a variable between two functions in tkinter python? How do I pass a variable between two functions in tkinter python? tkinter tkinter

How do I pass a variable between two functions in tkinter python?


This is a classic problem when using functions. Within a function all the variables are local so they only exist in that function what you need to do is globalise the variable so that it exist throughout the program. This is done by saying global and then the variable name before defining said variable.Your new code should look like this.

global folderfolder = filedialog.askdirectory()