swapping between menus in python
<p>How should I write this so I could constantly move between "menus".</p>

<pre><code> #!/bin/env python
  import os



class Menu:

    def __init__(self):
        self.menu = '1'

    def Main(self):

        os.system('clear')
        print "main menu"
        test = raw_input()
        if test == '2': 
            self.menu = '2'

    def Sub(self):

        os.system('clear')
        print "sub menu"
        test = raw_input()
        if test == '1': 
            self.menu = '1'


menu = Menu()

while menu.menu == '1':
    menu.Main()

while menu.menu == '2':
    menu.Sub()
</code></pre>

<p>At the moment I can swap once. ie I start with <code>menu.Main()</code>, enter '2' and <code>menu.Sub()</code> is shown. But then when I enter '1' the program quits. why does it not go back to showing menu <code>menu.Main()</code> ? Any thoughts welcome!</p>

<p>EDIT:</p>

<p>just needed to put them in a main while loop </p>
