GetComponnent null reference C#

My PlayerController script has a variable public bool grouned variable that attached to Player. In the other game object, I want to get information from PlayerController.grounded script but when running the game, it show error message with null reference.

PlayerController _myPlayer;

void Start (){
       _myPlayer = GetComponent<PlayerController>();
}

void Update(){
           if(_myPlayer.grounded)
          //Do_something
}

GetComponent function tries to get the component attached to the same game object it’s called from (so the same object your script is attached to). Istead, you can use, among others, FindObjectOfType<PlayerController>() function to get your PlayerController instance