Example:

func _process():

  somefunc(self.position)


func somefunc(property):
# the line below should change the node's postion
  property = Vector2(newX, newY)
  • That won't work. You need to pass a node reference to the function.

    somefunc(self)
    
    func somefunc(node: Node2D) -> void:
            node.position = Vector2(newX, newY)

    In your code, somefunc receives a copy of its parameter property, and changing it only changes that copy, and not the original node's position.

    (Edit: I changed Node to Node2D, since Node doesn't have a position property.)

That won't work. You need to pass a node reference to the function.

somefunc(self)

func somefunc(node: Node2D) -> void:
        node.position = Vector2(newX, newY)

In your code, somefunc receives a copy of its parameter property, and changing it only changes that copy, and not the original node's position.

(Edit: I changed Node to Node2D, since Node doesn't have a position property.)

There is some simple workaround, though:

extends Node2D

var property: Vector2:
	set = set_property
	
func set_property(v: Vector2) -> void:
	property = v

func _ready() -> void:
	some_func(set_property)
	print(property)

func some_func(setter: Callable):
	setter.call(Vector2(0.1, 0.2))

As this uses a setter function, you can still set/get your property as before, like:

func _ready() -> void:
	property = Vector2(0.5, 1.5) # "directly" setting the value
	print(property)

I am sorry, I missed a much simpler workaround:

func set_property(property_name, property_value):
    self[property_name] = property_value

So you do not pass what could be called a reference or pointer but instead pass the property name as a string.

You can do that, but then you lose the benefit of type checking.