Python import scope issue
<p>I'm trying to do some script reuse for some python build scripts. An abbreviated version of my "reusable" part looks like (_build.py):</p>

<pre><code>Sources = []
Sources += glob('*.c')
Sources += glob('../FreeRTOS/*.c')
...
def addSources(directory, *rest):
  for each in rest:
    Sources += ['../'+directory+'/'+each+'.c']

def addSharedSources(*args):
  addSources('Shared', *args)
</code></pre>

<p>Then in the customized part, I have something like (build.py):</p>

<pre><code>#!/usr/bin/env python
from _build import *
...
#Additional source files from ../Shared, FreeRTOS and *.c are already in
addSharedSources('ccpwrite', 'discovery', 'radioToo', 'telemetry', 'utility')
</code></pre>

<p>Unfortunately, when I try to run build.py, I get a traceback that looks like:</p>

<pre><code>Traceback (most recent call last):
File "./build.py", line 8, in &lt;module&gt;
 addSharedSources('ccpwrite', 'discovery', 'radioToo', 'telemetry', 'utility')
File "/Users/travisg/Projects/treetoo/Twig/_build.py", line 49, in addSharedSources
 addSources('Shared', *args)
File "/Users/travisg/Projects/treetoo/Twig/_build.py", line 46, in addSources
 Sources += ['../'+directory+'/'+each+'.c']
UnboundLocalError: local variable 'Sources' referenced before assignment
</code></pre>

<p>So even though I did the wildcard import, it would appear that when the import function is called, it's not referencing my "global" variable imported from the original. Is there a way to make it work? I toyed around with <code>global</code>, but that didn't seem to do what I wanted.</p>
