title: Jupyter Notebook: Import .ipynb file and access it's method in other .ipynb file giving error
body: <p>I am fairly new to Jupyter Notebook. I have played around with it for a while. But this was my first time trying to import another notebook into my main class.</p>
  
  <p>For reference, I am using Anaconda 4.3.1 and Python v2.7.</p>
  
  <p>I am trying to replicate what I did in my python project to jupyter notebooks. It requires importing other .ipynb files (translated from the original .py files) into it to use relevant methods as desired.</p>
  
  <p>For this, I followed the directions as given on Jupyter Nbviewer <a href="http://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Importing%20Notebooks.ipynb" rel="nofollow noreferrer">Steps Link</a> which I found through my preliminary search on the following stack <a href="https://stackoverflow.com/questions/20186344/ipynb-import-another-ipynb-file">Question</a>. It gave me some idea but didn't help me after one stage.</p>
  
  <p>I will walk you through the steps I took and the sample program I tried.</p>
  
  <ol>
  <li><p>Created a small .ipynb file abc.ipynb as follows</p>
  
  <pre><code>def prt_n(str):
      print(str)
  if __name__ == '__main__':
      prt_n("in abc")
  </code></pre></li>
  <li><p>Created an .ipynb file to import Jupyter Notebook from the Jupyter link given above. Say, importer.ipynb.</p></li>
  <li><p>Run importer.ipynb</p></li>
  <li><p><code>import abc</code></p></li>
  <li><p><code>str="Hello Me"</code></p></li>
  <li><p>Test step <code>abc.__name__</code> results in <code>abc</code> as output.</p></li>
  <li><p><code>abc.prt_n(str)</code> throws following error</p></li>
  </ol>
  
  <p>*---------------------------------------------------------------------------</p>
  
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-9-2fb88a43c9e5&gt; in &lt;module&gt;()
  </code></pre>
  
  <p>----> 1 abc.prt_n(str)
  AttributeError: 'module' object has no attribute 'prt_n'*</p>
  
  <p>I was hoping that the answer will be <code>Hello Me</code>.</p>
  
  <p>Later, I want to actually create a myMain.ipynb file and in that I want to include 2-3 such notebooks and call their methods with required parameters.</p>
  
  <p>One such example can be a file <code>efg.ipynb</code> as follows:</p>
  
  <p><code>import abc
  a="Hello Notebook"
  abc.prt_n(a)</code></p>
  
  <p>I also want to make sure if there is any other way to do this?</p>
  
  <p>Note: I have already checked sys.executable and sys.path. Both have the same python path value.</p>
  
  <p>Any sort of help is welcome!</p>