title: Parse Python file and evaluate selected functions
body: <p>I have a file that contains several python functions, each with some statements. </p>
  
  <pre><code>def func1():
      codeX...
  def func2():
      codeY...
  </code></pre>
  
  <p>codeX and codeY can be multiple statements. I want to be able to parse the file, find a function by name, then evaluate the code in that function.</p>
  
  <p>With the ast module, I can parse the file, find the FunctionDef objects, and get the list of Stmt objects, but how do I turn this into bytecode that I can pass to eval? Should I use the compile module, or the parser module instead? </p>
  
  <p>Basically, the function defs are just used to create separate blocks of code. I want to be able to grab any block of code given the name and then execute that code in eval (providing my own local/global scope objects). If there is a better way to do this than what I described that would be helpful too. </p>
  
  <p>Thanks</p>