code: def global_callback(self):
          
          widget = QApplication.focusWidget()
          action = self.sender()
          callback = from_qvariant(action.data(), to_text_string)
          from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
          from spyder.plugins.ipythonconsole.widgets import ControlWidget
  
          if isinstance(widget, (TextEditBaseWidget, ControlWidget)):
              getattr(widget, callback)()
          else:
              return
docs: Global callback