As I know, %debug magic can do debug within one cell.
%debug magic
However, I have function calls across multiple cells.
For example,
In[1]:
Your return function is in line of def function(main function), you must give one tab to it. And Use
%%debug
instead of
%debug
to debug the whole cell not only line. Hope, maybe this will help you.