It looks like you're new here. If you want to get involved, click one of these buttons!
LayoutView.on_annotations_changed() is called when
LayoutView.each_annotation() is not updated with last change (added or removed annotation), so as of now it's not possible to track exact annotations changes.
Other problem is
QObject.sender(): I expect it to return current view, but
None is returned.
I tried next script in 0.26.4 and 0.27.9:
import pya instance = None class Test(pya.QObject): def __init__(self, current_view): self.__current_view = current_view self.__current_view.on_annotations_changed = self.annotations_changed def annotations_changed(self): print('sender ', self.sender()) for annotation in self.__current_view.each_annotation(): print(annotation) def test(): global instance instance = Test(pya.Application.instance().main_window().current_view())