I am writing a .py file that will be regularly imported at the beginning 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 a package in non-interactive mode.
This is basically a module that contains many classes and functions that are very common.
Since I use IPython with the option --pylab=inline, the numpy functions as well as the matplotlib functions are already imported, but when you start in batch mode with a simple, python mymodule.pyyou need to specially import the numpy functions.
In the end, I came up with dual imports during an IPython session, which I really dislike.
What is the best practice in this case? Doesn't import modules twice in bad practice?
source
share