Sorry for the awkwardly phrased title.

Currently, I'm using Tkinter to create a UI for my program. I'm using individual classes for my Tk windows, one as a main menu that's always open and others that open for brief periods of interaction. I was hoping to have other functions interact with my main function by naming it and then calling it by its global name.

Upon testing though, I'd end up with NameErrors. I boiled it down to this example in IDLE:

```
>>> def test():
    mm.do()

>>> class tclass:
    def __init__(self):
        self.text = "Test text"
        test()
    def do(self):
        print self.text

>>> mm = tclass()

Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    mm = tclass()
  File "<pyshell#15>", line 4, in __init__
    test()
  File "<pyshell#8>", line 2, in test
    mm.do()
NameError: global name 'mm' is not defined

```

Does anyone have any suggestion to circumventing this problem?

Update, more info: Basically I was trying to have a window's buttons disabled upon opening the new window, then after a certain point in the new window's functions, to call the main menu's function to re-enable its buttons. I'm still actively learning Python as I progress through this project, and hadn't realized my Tkinter tutorials used old code. I haven't had a need for classes up to this point. I will now convert to new style classes.