How to do something when the mouse moves/ something is drawn

When creating plugins, you can use not only Krita’s plugin API but also pyQt’s API.
Referring to topics related to this may give you some hints on how to achieve what you want to do.