[IPython-dev] test from where a module is imported

Johann Rohwer jr at sun.ac.za
Thu Jul 17 04:19:40 EDT 2014

Sorry if this appears multiple times, my first post does not seem to have made 
it to the list.
Hi all,

Say I'm developing a Python module and would like to know from where the user 
imports this module, i.e. from a regular Python shell, an IPython shell, an 
IPython qtconsole, or an IPython notebook. I would like to enable additional 
features in my module depending on e.g. useful stuff that is available in the 
notebook. But I want the module also to be able to be imported and run in any 
of the other environments, so it's really more like a test from where we are 

I can think of various hacks on how to achieve this but would like to know if 
there is The Right Way (TM) and if so, what it is.


The integrity and confidentiality of this email is governed by these terms / Hierdie terme bepaal die integriteit en vertroulikheid van hierdie epos. http://www.sun.ac.za/emaildisclaimer

More information about the IPython-dev mailing list