Custom backward() breakpoint doesn't get hit

You should put this line:

pydevd.settrace(suspend=False, trace_only_current_thread=True)

inside your backward function instead of calling it right after your import! No need to set suspend=True. (While you probably don’t care about it anymore, I just prove-read this thread to help future readers.)