title: Using pkgutil.iter_modules with py2app
body: <p>In my game, I have a lot of different levels, in the following structure:</p>
  
  <pre><code>+ levels/
    - Level1.py
    - Level2.py
    - Level3.py
    - ...
  </code></pre>
  
  <p>Level1.py contains <code>class Level1</code>, and all the others likewise.</p>
  
  <p>I could import each of my levels thusly:</p>
  
  <pre><code>from levels.Level1 import Level1
  </code></pre>
  
  <p>but since I have a lot of them, and I want to import them all in the same place, I wrote a <code>load_levels</code> function that sits in <code>levels/__init__.py</code>:</p>
  
  <pre><code>def load_levels(game,window):
    levels = {}
    for loader, mod_name, ispkg in pkgutil.iter_modules(path=__path__):
      #import and initialise level
    return levels
  </code></pre>
  
  <p>This works great, until I package the application up using <code>py2app</code>. Then <code>pkgutil.iter_modules</code> contains nothing, presumably because it cannot run within a zip directory (<code>__path__</code> is <code>['/.../dist/main.app/Contents/Resources/lib/python35.zip/levels']</code>)</p>
  
  <p>What can I do here? Is there a way to configure <code>py2app</code> not to zip the directory, or <code>pkgutil</code> to work within the zip file?</p>