I am trying to import another file to be executed when clicking a button. So I have:
from tkinter import *
import file
window = Tk()
button = Button(window, text='GO', command=file.function())
button.grid(column=1, row=1)
This executes the file before the window is initialized. I also tried:
from file import function
button = Button(window, text='GO', command=function())
but it does the same thing. And neither of them are executed when clicking the button. How do you import files or functions but only executing them when the button is clicked? I am using python 3.5. Thank you