title: Convenience function defined for debugging with ipdb in Python
body: <p>At the top of my Python scripts I have defined the following convenience function for debugging with ipdb:</p>
  
  <pre><code>def bp():
      import ipdb
      ipdb.set_trace()
  </code></pre>
  
  <p>So when I want to debug in a certain point I can write: </p>
  
  <pre><code>bp() 
  </code></pre>
  
  <p>instead of having to write </p>
  
  <pre><code>import ipdb; ipdb.set_trace()
  </code></pre>
  
  <p>(I prefer not to import ipdb unless needed).</p>
  
  <p>The problem with this approach is that when entering pdb I land inside the function bp(), so I have to press 'u' to go to the relevant part of the code:</p>
  
  <pre><code>&gt; /path/to/script.py(15)bp()
        14     import ipdb
   ---&gt; 15     ipdb.set_trace()
        16 
  
  ipdb&gt; u
  </code></pre>
  
  <p>Is there a way I could have a similar approach, but landing directly into the relevant part of the code?</p>