# Execute commands when starting ipdb [closed]

I usually debug a python script by putting the following line into the source code:

import ipdb; ipdb.set_trace()


Then when I run the script, ipdb starts. Very often I need to plot some arrays in an interactive graph. I use the following commands to make it possible inside the ipdb:

import matplotlib.pyplot as plt
plt.ion()


My question is whether it is possible to run these two commands automatically when ipdb starts.

P. S. I put this question here, in Computational Science, as I believe that ipdb is mostly used by people who do scientific computing.

• I'm voting to close this question as off-topic because this is a python programming/debugging question which is better suited to Stack Overflow. – Bill Barth Jun 2 '15 at 15:29