title: Import all files from a folder on python
body: <p>I have a folder with a few python files:</p>
  
  <pre><code>modules
  |--&gt; __init__.py
  |--&gt; car.py
  |--&gt; plane.py
  |--&gt; ship.py
  |--&gt; etc...
  </code></pre>
  
  <p>Each of this files consists on this:</p>
  
  <p>car.py</p>
  
  <pre><code>NAME = "car_name"
  def mainloop(*args):
      ...
      return whatever
  </code></pre>
  
  <p>plane.py</p>
  
  <pre><code>NAME = "some_different_name"
  def mainloop(*args):
      ...
      return whatever
  </code></pre>
  
  <p>and so on...</p>
  
  <p>I want to import them dynamically from my parent dir as a dict like this:</p>
  
  <pre><code>from modules import modules
  print(modules)
  {
      "car_name": &lt;function mainloop at ...&gt;,    
      "some_different_name": &lt;function mainloop at ...&gt;,
      etc..
  }
  </code></pre>
  
  <p>I don't know how many files will be on the folder or the filenames.
  How can I do it?</p>