How to properly manipulate reference images in scripts?

  1. createNode
  1. Here is an example:

The UI framework used by krita is QT, the python version is pyqt. The undo docker is a krita docker, the above example uses the layer docker to monitor changes, you can do the same with the undo docker