I've created a couple of modules that are used in a game I'm trying to write. The modules themselves work fine (as part of the main program), but hang if I run them separately. Is there a way to make them not run/load up or perhaps instantly quit unless they are imported and run by the main program?
I'm very new to programming and make a lot of mistakes, so I constantly test run the code and at times forget to switch from the "module.py" tab to my "main.py" tab. It loads up the window and hangs, leaving no choice but to force-quit it from the task bar.