If you want to access a variable after the tkinter window closes, then you have to make it an instance object. Snipped version of your code
def change_dropdown(*args): self.remaining_variable=self.tkvar.get() print(self.tkvar.get() ) # link function to change dropdown self.tkvar.trace('w', change_dropdown) master = tkinter.Tk() master.title("Sheetauswahl") app = App(master) master.mainloop() ## app=instance, App=class ## app remains until you destroy it or close the program print(app.remaining_variable) sheet = app.remaining_variable df = pd.read_excel(Filename, sheet_name=sheet)