diff --git a/spyder/api/widgets/menus.py b/spyder/api/widgets/menus.py index 8b866c8ba93..79362f2ebe1 100644 --- a/spyder/api/widgets/menus.py +++ b/spyder/api/widgets/menus.py @@ -169,7 +169,15 @@ def add_action(self: T, action: Union[SpyderAction, T], def remove_action(self, item_id: str): if item_id in self._actions_map: action = self._actions_map.pop(item_id) - self._actions.remove(action) + position = None + + for i, (_, act) in enumerate(self._actions): + if act == action: + position = i + break + + if position is not None: + self._actions.pop(position) def get_title(self): """