Hi,
I would like to be able to know how to know programmatically if my script is being executed in juypterlab.
I would like to be able to distinguish between these two situations:
script running in ipykernel non-jupyterlab
script running in jupyterlab.
Is there a function I can exploit, or how can I write it?
Thank you in advance
Thank you for your response.
I would like to be able to define whether a py script is being executed by JupyterLab or not.
I give below an imaginary example. I want to be able to do so:
import IPython
def whereami():
if IPython.utils.is_jupyterlab(): # <- invented function
print("I'm running from JupyterLab")
my_function_for_JL()
else:
my_other_function()
return
I give another example.
If I wanted to put a script among the startup scripts, I would want it to activate certain functions only if it is run in jupyterlab.
Is it possible to do this? Are there utility functions from IPython or some module in the jupyter stack?