Position is modified into Update() but not into other functions

Hello, this is a part of my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{

    void Update()
    {
        print("Update" + transform.position);
    }

    public Vector3 SendPosition()
    {
        print("Function" + transform.position);
        return transform.position;
    }
}

the problem appear when I execute: in the console, while I move the object i can see the two outputs. The “Update” one works fine, but the “Function” one prints only the initial position, and when it’s called by another script, the output remain the same.
Thanks for the help.

Can you show the other script where you are calling the function?

We need to know other scripts too and your objective because i didn’t understand what you need. Do you need to get the position of the script from other scripts or you need to send the position from where you call the function?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Pisces : MonoBehaviour
{
    [SerializeField] GameObject player_prefab;
    [SerializeField] float laser_reload = 5f;
    bool is_alive = true;

    Vector3 player_pos;
    Vector3 direction;
    float rotation_z;
    Coroutine laser_coroutine;

    void Start()
    {
       
    }

    void Update()
    {
        if (is_alive)
        {
            rotation_z = GetPlayerAngulation();
        }
    }

    private float GetPlayerAngulation()
    {
        player_pos = player_prefab.GetComponent<Player>().SendPosition();

        direction = player_pos - transform.position;
        rotation_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
        return rotation_z;
    }

    IEnumerator FireLaser()
    {
        while (true)
        {
            shark_eye.GetComponent<SharkEye>().Fire(rotation_z);
            yield return new WaitForSeconds(laser_reload);
        }
   }

}

Ok I managed to get it working by myself. Instead of call a function between the two scripts, it’s better to use the function GameObject.Find(“Player”).transform.position;