Dec-08-2020, 08:58 PM
Hi,
I have python project I am building. It includes a main.py and several other .py files. When I import these other files into main.py, the import executes the functions from them. To stop this, i put an if __name__ == "__main__" statement in the functions of the other programs. However, I have a tkinter GUI with several buttons. These buttons execute functions from the other python files. how do i bypass the if __name__ == "__main__" so that the button can execute the command?
Thanks in advance
MrBitPythoner
I have python project I am building. It includes a main.py and several other .py files. When I import these other files into main.py, the import executes the functions from them. To stop this, i put an if __name__ == "__main__" statement in the functions of the other programs. However, I have a tkinter GUI with several buttons. These buttons execute functions from the other python files. how do i bypass the if __name__ == "__main__" so that the button can execute the command?
Thanks in advance
MrBitPythoner