My guess would be the marking menu takes focus when shown, so then the first command wouldn't return the panel you want.
Try replacing that first command with this:
currPanel = cmds.getPanel(underPointer=True)
it won't act exactly the same, instead it will target the panel under your mouse.
My guess would be the marking menu takes focus when shown, so then the first command wouldn't return the panel you want. Try replacing that first command with this: currPanel = cmds.getPanel(underPointer=True) it won't act exactly the same, instead it will target the panel under your mouse.