How to import other Python files in Python
<p>I have a newbie question about importing in Python</p>

<ol>
<li>How exactly can I import a specific python file .. <code>import file.py</code> sometimes doesn't work  </li>
<li>How to import a folder ... instead of a specific file  </li>
<li>and most importantly, I want to load a Python file dynamically in runtime, based on user input</li>
<li>I want to know how to take from the file just one specific part.</li>
</ol>

<p>For example, in <code>main.py</code> I have</p>

<pre><code>from extra import * 
</code></pre>

<p>although this gives me all the file actions of <code>extra.py</code> when maybe all I want is 
a single definition</p>

<pre><code>def gap():
    print
    print
</code></pre>

<p>What do I add to the <code>import</code> statement to just get <code>gap</code> from <code>extra.py</code>?</p>
