title: what is the scope of an imported function in python 3
body: <p>Say we have a python script with:</p>
  
  <pre><code>def add(a):
     a += b
     print(a)
  b=5
  add(3)
  </code></pre>
  
  <p>this outputs:8</p>
  
  <p>but if we import the function <code>add</code> from another python file <code>some_utils.py</code></p>
  
  <pre><code>from some_utils.py import add
  
  b=5
  add(3)
  </code></pre>
  
  <p>this comes back with an error that <code>b</code> is not defined</p>
  
  <p>How to get around this ?</p>
  
  <p><strong>PS</strong> the main idea is not to pass a lot of variables every time to that function</p>