title: ipython -pylab debugging: Can I stop the execution at a specific line and drop into the shell?
body: <p>When writing python code (mostly <em>numpy + matplotlib</em>), I usually just type the code in <em>vim</em> and run the program to test it: </p>
  
  <p><code>python2 foo.py</code></p>
  
  <p>Occasionally, when this is not sufficient and I need to inspect the problem more thoroughly, I just launch the program in ipython:
  <code>ipython -pylab foo.py</code>, and then inspect the variables, test some commands and so on. I like <code>ipython</code>, because of the tab completion and the availability of <em>bash</em> commands.</p>
  
  <p>This worked well enough for me, but now my programs grew bigger and include many subroutines (in multiple files). The <code>ipython</code> approach doesn't work any more, because it always runs the <strong>complete code</strong> till the end of <code>foo.py</code> (when it drops into the pylab shell). What I'd like to do instead is, stop execution at a given line in a subroutine (could be in another file) and inspect variables there. <strong>I.e. set a break point at which the pylab shell kicks in.</strong></p>
  
  <p>Is there an <em>easy way</em> to adapt my <code>ipython</code> way of working? E.g. stop at a line in <code>bar.py</code></p>
  
  <pre><code>ipython -pylab --stop-at bar.py:423 foo.py
  </code></pre>
  
  <p>or, stop at a subroutine name in <code>bar.py</code></p>
  
  <pre><code>ipython -pylab --stop-at bar.py:subroutine-name foo.py
  </code></pre>