title: Requests not defined after importing from a file
body: <p>I have imported a file <code>image_function.py</code> to my notebook. However when i tried using one of the functions <code>im_reverse</code>, it gave me an error.</p>
  <p>Code:</p>
  <pre><code>import image_function
  image_function.im_reverse(&quot;https://allhdwallpapers.com/wp-content/uploads/2015/05/sunset-8.jpg&quot;, reverse = 'horizontal', url = True)
  </code></pre>
  <p>Error:</p>
  <pre><code>---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  &lt;ipython-input-61-afc744ac8a12&gt; in &lt;module&gt;()
        1 import image_function
  ----&gt; 2 image_function.im_reverse(&quot;https://allhdwallpapers.com/wp-content/uploads/2015/05/sunset-8.jpg&quot;, reverse = 'horizontal', url = True)
  
  /content/image_function.py in im_reverse(image_path, reverse, url)
       45           mat_image_column_reverse[c][i] = mat_image_reverse[j][i]
       46           c += 1
  ---&gt; 47 
       48       plt.axis('off')
       49 
  NameError: name 'requests' is not defined
  </code></pre>
  <p>The error happened before it reached the code for reversing vertically, which is down below.</p>
  <p>What's inside image_function:</p>
  <pre><code>#libraries:
  import matplotlib.pyplot as plt
  import numpy as np
  from matplotlib.pyplot import imshow
  from PIL import Image
  import copy
  import requests
  from io import BytesIO
  </code></pre>
  <p>This is the code after the error:</p>
  <pre><code>def im_reverse(image_path, reverse = 'horizontal', url = True):
    if url == True:
      response = requests.get(image_path)
      with Image.open(BytesIO(response.content)) as image:
        mat_image = np.array(image, dtype=int)
        m, n, depth = mat_image.shape
  
      if reverse == 'horizontal':
        mat_image_reverse = copy.deepcopy(mat_image)
        mat_image_rows_reverse = copy.deepcopy(mat_image)
        
        for i in range(m):
          c = 0
          for j in range(n-1,-1,-1):
            mat_image_rows_reverse[i][c] = mat_image_reverse[i][j]
            c += 1
        
        plt.axis('off')
        return imshow(mat_image_rows_reverse) 
  </code></pre>
  <p>I have tried a lot of solutions on the web. However i dont see anything wrong. I have also tried a deliberate <code>from requests import get</code> or <code>!pip install requests</code> and it still didn't work.</p>
  <p>Can anyone please offer a solution. Thanks</p>