def METHOD_NAME(self):
    frame = self.excHandler.selectedFrame()
    if frame is not None and self.excHandler.runSelectedFrameCheck.isChecked():
        return frame.f_globals
    else:
        return self.localNamespace