Why is variable undefined in function?
<p>I have function:</p>

<pre><code>def parsePage(url): 
    cur.execute("""UPDATE ap SET status=%s WHERE app='%s'""", (1, url))
</code></pre>

<p>Where try to make update query in db.</p>

<p>I call function <code>ParsePage</code> from another function <code>parseDetails</code> as:</p>

<pre><code>def parseDetails():
    try:
        cur.execute("SELECT * FROM app WHERE status = 0")
        p = multiprocessing.Pool()
        p.map(parsePage, arr)
    ...
</code></pre>

<p>Why I can access to <code>cur</code> in function  <code>parseDetails()</code>, but I get error in when I get error: <code>cur undefined</code> in line:</p>

<pre><code>cur.execute("""UPDATE ap SET status=%s WHERE app='%s'""", (1, url))
</code></pre>