title: How can you run a python function stored in a different file
body: <p>I know how to do this in C, but I'm not sure how to do it in python. I'm trying to make a python program which will read from an external file, then execute a function name which was read from that file. Example:</p>
  
  <p>File structure:  </p>
  
  <pre><code>main.py  
  map.py  
  Scripts/  
    script1.py
  </code></pre>
  
  <p>map.py contains just an array and a function to get the correct array index:</p>
  
  <pre><code>map = ["One","script1.function_one","Two","scrip1.function_two"]
  def return_mapping(str):
    for i in range(0,len(map)):
      if str in map[i]:
        return map[i+1]
  </code></pre>
  
  <p>The functions: "function_one()" and "function_two()" are defined in script1.py.
  main.py will contain something like this:</p>
  
  <pre><code>selection = raw_input("What function would you like to run?")
  function_ptr = map.return_mapping(selection)
  #This is where I don't know what the correct code is... I want to now execute
  #whatever function was returned.
  </code></pre>
  
  <p>Any suggestions?</p>