What does your scene look like? What code have you tried? Which node is the script attached to and which node are you trying to get the position of? Without knowing more, it is hard to help find a solution.
If you have a scene like the following:
- Root_Node
- Child_One
- Child_Two
- Child_Two_Child
And you want to get the position of the Child_Two_Child node in a script attached to Child_One, then the following should work:
extends Node2D
func _ready():
var root_node = get_parent()
var child_two = root_node.get_node("Child_Two")
var child_two_child = child_two.get_node("Child_Two_Child")
var child_two_child_position = child_two_child.global_position
print ("The child node of Child_Two is at position: " + String(child_two_child_position))
You can also use an exported variable to get the node if that makes it easier. Then you can just select the node you want through the Godot editor by selecting the node and assigning the node path in the inspector:
extends Node2D
export (NodePath) var target_node_nodepath = null
var target_node
func _ready():
# Note: you will need to set target_node_nodepath in the editor!
target_node = get_node(target_node_nodepath)
print ("Position of target node: " + String(target_node.global_position))
Hopefully this helps!