title: How to access or change the value of a variable inside a function which is nested inside another fucntion?
body: <pre><code>def next1():
      x=1
      def nest2():
         x+=1
         nest2()
      return x
  </code></pre>
  
  <p>When I try to call the fucntion nest1(), it says "local variable 'x' referenced before assignment
  ". I want to access x which is declared at line 2 inside nest2(). What is the solution?</p>