Suppose I have a Python script called my_script.py with a one function called my_func() inside. I import this script into a Jupyter Notebook so I can run my_func() in the cells.
My question is, in the definition of my_func(), how to find which cell number it is called from, so that I can log the cell number? Any API that I could use?
Something like
# my_script.py
def my_func():
# find which cell this is called from
cell_number_called_from = some_IPython_history_class_api.get_current_cell()
# log the cell number and do the rest of my things