I want my function to do one thing if it's called from the IPython notebook and another thing if its called from a console or library code. In particular I'm making a progress bar with the desired following behavior:
- Notebook: Immediately return a widget
- Console: Block and dump information to
sys.stdout
Is there a flag somewhere I can check to determine if the user called my function from a notebook or otherwise?