Python recognizes globals if not in class or function