Jul-05-2019, 01:22 PM
NO -- if at all possible do not use global variables or even semi-global variables in most (not all) cases these types of variables are completely unnecessary and always very dangerous and a nightmare if a bug develops because of one. Basically global and semi-global variables are due to lazy minded coding -- a properly designed program should never need these kinds of variables especially with python as your base language. Keep in mind a Class should be autonomous never dependent upon any outside variables and your program should be class-ified thus meaning all variables are contained within their appropriate class. Again I know your pain, having had to do this numerous times myself but the best method I could find is start mapping these variables out as well as the code structure and then figure out where the break-down has occurred and address that point(s) eventually you should be able to eliminate nearly all globals and semi-global variables and have your variables all properly contained. Good luck and above all things just have fun its grand puzzle you are trying to solve one that has numerous pieces that are interchangeable but only the right piece is going to make the picture viewable.