I'm writing a .py file which will be regularly imported at the start of some of my IPython sessions in the first cells but will also be imported from other non-interactive sessions, since it contains functions that can be run in batch in non-interactive mode.
It is basically a module containing many classes and functions that are very common.
Since I'm using IPython with the --pylab=inline
option, numpy as well as matplotlib functions are already imported, but when run in batch with a simple python mymodule.py
the numpy functions have to be imported specifically.
At the end I'd come up with double imports during the IPython session, a thing I don't like very much.
What is the best practice in this case? Isn't importing modules twice a bad practice?