How to start renaming inspector gameobject by code

I woud like to call in code the “Start Renaming” function on a gameobject in the inspector (the exact same behaviour as when you press F2 in Windows on a gameobject).

How can I do that in code?

Example:

    private GameObject player;

    private void Start()
    {
          player = GameObject.FindGameObjectWithTag("Player");
          player.gameObject.name = "NewName";
    }

Result in game:

I mean specifically the START renaming process, I want to type in the inspector what the name will be. I don’t know the name in code yet.