title: How to return to previous function after calling another function?
body: <p>I'm working on a text-based RPG currently.  It is very simple, but I'm still having some issues, as I'm fairly new to Python.  I want the player to be able to call a certain function, then after they are done, to return to the function they were on before.  </p>
  
  <pre><code>def inventory():
      invent = {'a': 1, 'b':2}
      print invent
  
  def room_function():
      input = raw_input("Type [i] for inventory!").lower()
      if input == 'i':
         inventory()
  </code></pre>
  
  <p>As shown above, I want the player to be able to call their inventory from any given function they are in.  After they call the function, I want the player to be able to return to the function they were in.  This example of code is very, very simplified.  Here is a more elaborate example of my code:</p>
  
  <pre><code>inventory = {'Backpack': ['Water Bottle', 'Apple', 'Book'],
      'Clothes': ["Business Casual Attire"],
      'Weapon': ['None']
                   }
  
  def equip():
      print inventory
      equip_items ={'Clothes': "Business Casual Attire",
          'Weapon': 'None'}
  
      while equip:
          print ' '
          equip_load = raw_input("Type the item name to equip.: ").lower()
          if equip_load == 'hipster attire':
              if 'Hipster Attire' in inventory['Clothes']:
                  print "Hipster Attire has been equiped!"
                  print "UPDATED EQUIPPED ITEMS"
                  print ' '
                  for x in equip_items:
                      if x in equip_items:
                          inventory['Clothes'] = 'Hipster Attire'
                          print equip_items
                          continue
              else:
                  print "You do not have this item! "
                  print "Your inventory list is: "
                  equip()
  
  def room():
      #Player does stuff here; allows them to access inventory equip new items.
  </code></pre>
  
  <p>So my idea is to combine the equip items mechanism with the inventory system.  To do this, I need the player to be able to call their inventory function, and then from there, exit that function and return to whatever function they were in.  Am I setting this up correctly?  Or am I really off the ball here, so to speak?  Am I understanding these concepts correctly?  Thanks for the help.</p>