title: What is the correct way to import modules when I'm writing my own module in python?
body: <p>I've searched for similar questions, but what I've found doesn't work for me.<br>
  I'm writing the report of my analysis in a jupyter notebook (let's say <code>main.ipynb</code>). I want to import an external <code>functions.py</code> file with some functions that I use to plot some results. To be precise, my working directory has the following structure:<br>
  -<code>main.ipynb</code><br>
  -<strong>utils</strong><br>
  ----<code>functions.py</code><br>
  ---- other files...  </p>
  
  <p>The <code>functions.py</code> file is something like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  
  
  def myPlot():
      plt.figure()
      plt.plot([0,1],[0,1])
      plt.show()
      ....
  </code></pre>
  
  <p>and the first cell of the notebook is this:</p>
  
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  from utils.functions import *
  
  myPlot()
  </code></pre>
  
  <p>When I run the notebook I get this error:
  <code>NameError: name 'plt' is not defined</code>, although I have defined plt in both files (even if I think I really shouldn't need it in the <code>main.ipynb</code>).</p>
  
  <p>S0, what is the correct way to import a package (<code>matplotlib.pyplot</code> in this case) in an external file? What am I doing wrong?</p>