Replace:
def browsefunc(): filename = filedialog.askopenfilename() return filename
with:
filename = ''def browsefunc(): global filename filename = filedialog.askopenfilename()
When a method can't return.
What you're doing here is saving the file name to a local variable and binding the function to a button. If you want to use that variable you can make a global variable where you can save the path whenever you choose a new one.