'How to invoke a function when changing position?

I'm trying to invoke a function everytime the position of a position2D node is changed

I tried to override the setter as given in the docs like this:

extends Position2D
tool

func set_position(value):
    print("changed position ",value)
    self.position=value;

what am I missing here? is there a way to achieve what I'm trying?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source