python file call another python script background and access variables?
<p>I have this scenario</p>

<p>I have a python script <strong>webservice.py</strong> (using cherrypy) running when linux starts</p>

<p>I have another script that dose som files copy and few loops <strong>copyfiles.py</strong> and save some values in few variables (x,y,z)</p>

<p>how I can call (going to <a href="http://localhost/start" rel="nofollow noreferrer">http://localhost/start</a>) <strong>copyfiles.py</strong> from <strong>webservice.py</strong> in the background and capture values x,y and z?</p>

<p>so when I call the <a href="http://localhost/status" rel="nofollow noreferrer">http://localhost/status</a> it reads the values (x,y and z) from the <strong>copyfiles.py</strong> and return it to the web?</p>

<p>so far I came with this in <strong>webservice.py</strong></p>

<pre><code>import cherrypy

cherrypy.config.update({
    'server.socket_host': '0.0.0.0',
    'server.socket_port': 80,
})


class WebGUI(object):
    @cherrypy.expose
    def index(self):
        return "&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;title&gt;Test 001&lt;/title&gt;&lt;body&gt;&lt;h1&gt;Welcome to Test 001&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;"

    @cherrypy.expose
    def start(self):
        subprocess.Popen(["nohup", "python", "copyfiles.py"])
        return "Files copy started ..."

    @cherrypy.expose
    def status(self):
        ..............
        ..............



if __name__ == '__main__':
    cherrypy.quickstart(WebGUI())
</code></pre>