Breakpoints being skipped when debugging OnPushButton or click events

Every time I put a breakpoint on code triggered by a mouse click event the breakpoint is ignored when debugging. Unfortunately this leads to a crash, and because I cannot step through I don’t know where the crash is happening. Am I missing something?

I have created a button call btnLoadVise1

Then all do all the event handling stuff below

self.btnLoadVise1.Click += self.btnLoadVise1_Click
    def btnLoadVise1_Click(self,sender,e):
        Rhino.UI.EtoExtensions.PushPickButton(self, self.OnPushButton_LoadVise1)

I place a breakpoint in the OnPushButton_LoadVise1 method shown below but the debugger ignores it

  def OnPushButton_LoadVise1(self,sender,e):
        if rButtonVise1_46mm.Checked:
            viceName = "Vice 1"
            checked = self.checkBoxMirror.Checked
            whichVice,viceName = SetVice(viceName)
            detailToMove,target = Orientate(whichVice)

Any help would be appreciated.

Edit: I also get the same issue when not using the PushPickButton, just using a standard mouseclick event.

That looks incorrect. The implementation of btnLoadVise1_Click makes no sense, that is essentially just instantiating a PushPickButton.

Instead of doing self.btnLoadVise1.Click += self.btnLoadvise1_Click do self.btnLoadVise1.Click += self.OnPushButton_LoadVise1.

Thank-you Nathan, this is the first time I’ve used PushPickButton, just learned about it from somewhere here on the forum. It seemed like a weird way to do it to me as well, but it worked so I just stuck with it. I edited the code to reflect the way you said and it works as well. Thank-you very much, that cleans things up big time. That being said, my breakpoints are still being ignored, in either setup.

Not sure how debugging in EditPythonScript is supposed to work, maybe @eirannejad knows more?