Box pickup system for a top down game

Godot Version

4.2.2

Question

Good evening, I am on the latest version of godot 4 for a top down game and I am trying to create a system so that the player can lift a box which is composed of a rigidbody2d and a collisionshape2D as a child. With my code the collision shape does not follow the rigidbody2D, but stays in place. I don’t know how to do it, I’m having a lot of trouble. Thank you in advance for your help.

My code : "

extends CharacterBody2D

# Exported variable for speed, adjustable from the Godot editor.
@export var speed: int = 500
@onready var animations = $AnimationPlayer

# Variable to keep track of the box being carried
var carried_box: RigidBody2D = null
var carried_collision_shape: CollisionShape2D = null

func handle_input():
	# Get the directional input from keyboard.
	var move_direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
	# Update the velocity based on direction and speed.
	velocity = move_direction * speed

	# Check for pickup/put down input
	if Input.is_action_just_pressed("pickup"):
		if carried_box == null:
			try_to_pick_up_box()
		else:
			put_down_box()

func update_animation():
	if velocity.length() == 0:
		if animations.is_playing():
			animations.stop()
	else:
		var direction = "Down"
		if velocity.x < 0: direction = "Left"
		elif velocity.x > 0: direction = "Right"
		elif velocity.y < 0: direction = "Up"
		
		animations.play("walk" + direction)

func _physics_process(delta):
	# Handle input each physics frame.
	handle_input()
	# Move the character based on the velocity.
	move_and_slide()
	
	update_animation()

func try_to_pick_up_box():
	# Get overlapping bodies
	var space_state = get_world_2d().direct_space_state
	var query = PhysicsShapeQueryParameters2D.new()
	query.transform = Transform2D().translated(global_position)
	query.shape = RectangleShape2D.new()
	query.shape.extents = Vector2(32, 32) # Adjust based on box size and detection range
	
	var result = space_state.intersect_shape(query)
	
	for body in result:
		if body.collider is RigidBody2D:
			var box = body.collider
			var collision_shape = box.get_node("CollisionShape2D")
			if collision_shape:
				carried_box = box
				carried_collision_shape = collision_shape
				carried_collision_shape.disabled = true  # Disable the collision shape
				carried_box.freeze_mode = RigidBody2D.FREEZE_MODE_KINEMATIC  # Set to kinematic when picked up
				break

func put_down_box():
	if carried_box != null:
		carried_collision_shape.disabled = false  # Re-enable the collision shape
		carried_box.freeze_mode = RigidBody2D.FREEZE_MODE_STATIC  # Set back to static when put down
		carried_box = null
		carried_collision_shape = null

func _process(delta):
	if carried_box != null:
		carried_box.global_position = global_position + Vector2(10, 10)  # Adjust offset

"

Are you insistent of having two separate bodies? From what I can tell, you could create a new box scene and instance it every time you need a box. Then, in your code, you can replace carried_box with the whole box, not just the RigidBody2D, and you could still make everything work.
I also don’t happen to see anything moving the box or its collider.