Tkinter button only works once Tkinter button only works once tkinter tkinter

Tkinter button only works once


You can't import a module multiple times. Each additional import for the same module is a NOP. You need to functionize whatever is in sendRF, and call that function in test_function.


You can check if the function is working correctly by adding a simple print statement inside your function

from tkinter import *#create a windowwindow =Tk()window.title("Chappers Home Automation project")#define a functiondef test_function ():    import SendRF    print('CHECK') #create a buttonB = Button(text ="Test Button 1", command=test_function)B.pack(padx = 100, pady = 50)window.mainloop()


It is working one time, cause you alredy have the SendRf function mported, you need to close it, after to import again