Why do I get an error in python saying that a method cannot be found even though I previously defined the method?
<pre><code>index = 0
def changeColor():
    global index
    if index%2==0:
        label.configure(bg = "purple")
    else:
        label.configure(bg = "blue")
    index+=1
    label.after(1000, changeColor)   

def Start (self): # command when start button is clicked in GUI
    self.root = Tk()
    self.root.geometry("500x300")
    mainContainer = Frame (self.root)
    label = Label(mainContainer, text = "")
    label.pack(side = LEFT, ipadx = 5, ipady = 5)
    mainContainer.pack()
    label.after(1000, changeColor)
    self.root.mainloop()
</code></pre>

<p>I get an error saying: NameError: global name 'changeColor' is not defined. Why does this occur and how would I fix it?</p>
