Moving an object with the mouse

Godot Version 4,3

I move the object with the mouse using Area2D and collision. when I create two children Area() in the scene, when their collisions intersect, they both move behind the mouse. How can I make only one move?

code:
var select = false
var offset: Vector2

func _process(delta):
if select:
followMouse()

func followMouse():
if Input.is_action_just_pressed(“click”):
offset = get_global_mouse_position() - global_position
if Input.is_action_pressed(“click”):
global_position = get_global_mouse_position() - offset

func _on_area_2d_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
if event.pressed:
select = true
else:
select = false

Please format your code with triple backticks: ```[code]``` to help people help you.