Return values from one script to another script
<p>I have the following script that will run each script (sequentially) in a directory:</p>

<pre><code>import os

directory = []

for dirpath, dirnames, filenames in os.walk("path\to\scripts"):
    for filename in [f for f in filenames if f.endswith(".py")]:
        directory.append(os.path.join(dirpath, filename))
for entry in directory:
    execfile(entry)
    print x
</code></pre>

<p>my scripts look like this:</p>

<pre><code>def script1():
    x = "script 1 ran"
    return x

script1()
</code></pre>

<p>When <code>print x</code> is called, it says x is not defined.  I'm just curious if there is a way to return values so that the parent script can access the data. </p>
