I am an idiot and I don't understand scoping in Python