Import a whole folder of python files
<p>I am making a bot in python 3 and wish it to be easily expanded so I have a central file and then one for each command. I wish to know if there is a way to import a sub-directory full of modules without importing each separately. For example:</p>

<pre><code>example
âââ commands
âÂ Â  âââ bar.py
âÂ Â  âââ foo.py
âââ main.py
</code></pre>

<p>And the code in <code>main.py</code>would be something like:</p>

<pre><code>import /commands/*
</code></pre>

<p>Thanks :D</p>

<p><strong>Solution:</strong>
Import each separately with: 
<code>from commands import foo, bar</code></p>

<p><code>from commands import *</code> Does not work.</p>

<p>Import each separately with: 
<code>from commands import bar</code> and
<code>from commands import foo</code></p>

<p><code>from commands import *</code> Does not work.</p>

python python-3.x