title: load python code at runtime
body: <p>I would like to load a <code>.py</code> file at runtime.  This <code>.py</code> file is basically a config file with the following format:</p>
  
  <pre><code>var1=value  
  var2=value  
  predicate_function=func line : &lt;return true or false&gt;  
  </code></pre>
  
  <p>Once this file is loaded, I would like to be able to access <code>var1</code>, <code>var2</code> and <code>predicate_function</code>. For each line, I'll pass it to the predicate function, and if it returns false, I'll ignore it.</p>
  
  <p>In any case, I'm not sure how to load a python file at runtime and access its variables.</p>
  
  <p>Clarification: there may be any number of these config files that I need to pass to the main program and I won't know their names until runtime.  Google tells me I should use <code>__import__</code>.  I'm not sure how to correctly use that method and then access the variables of the imported file.</p>