title: Python: How to access variable declared in parent module
body: <p>Using the structure from the Python docs:</p>
  
  <pre><code>sound/
    __init__.py
    effects/
            __init__.py
            echo.py
            surround.py
            reverse.py
  </code></pre>
  
  <p>Say I want to <code>import sound.effects</code> and get a list of available effects.  I could do this by declaring a module-level variable in <code>sound.effects</code> and then appending to it when each .py file is imported.  So sound/effects/__init__.py might look like this:</p>
  
  <pre><code>effectList = []
  import echo
  import surround   # Could write code to import *.py instead
  ...
  </code></pre>
  
  <p>From my main code I can now access <code>sound.effects.effectList</code> to get a list of effects, but how do I access <code>effectList</code> from within echo.py to do the actual append?  I'm stuck trying to get access to the variable:</p>
  
  <pre><code># None of these work :-(
  # from . import self
  # from .. import effects
  # import sound.effects
  
  sound.effect.effectList.append({'name': 'echo'})
  </code></pre>