title: What is the right way to debug in iPython notebook?
body: <p>As I know, <code>%debug magic</code> can do debug within one cell.</p>
  
  <p>However, I have function calls across multiple cells.</p>
  
  <p>For example,</p>
  
  <pre><code>In[1]: def fun1(a)
             def fun2(b)
                 # I want to set a breakpoint for the following line #
                 return do_some_thing_about(b)
  
         return fun2(a)
  
  In[2]: import multiprocessing as mp
         pool=mp.Pool(processes=2)
         results=pool.map(fun1, 1.0)
         pool.close()
         pool.join
  </code></pre>
  
  <p>What I tried:     </p>
  
  <ol>
  <li><p>I tried to set <code>%debug</code> in the first line of cell-1. But it enter into debug mode immediately, even before executing cell-2.  </p></li>
  <li><p>I tried to add <code>%debug</code> in the line right before the code <code>return do_some_thing_about(b)</code>. But then the code runs forever, never stops.</p></li>
  </ol>
  
  <p>What is the right way to set a break point within the ipython notebook?</p>