Why is gameObject == null?

I’m facing a problem with my code. I’m calling a function from another script. However when I try to use gameObject it is null. I tried to make a public Sprite Renderer and set a reference in Unity and by code in the Start method. But it returns null as well. Can you help me here?

public class ChangeSprite : MonoBehaviour
    public Sprite[] spriteArray;

    public SpriteRenderer spriteRenderer;

    private void Start()
        spriteRenderer = gameObject.GetComponent<SpriteRenderer>();

    public void changeSprite(int diceNumber)
        Debug.Log(gameObject == null);
        spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
        Debug.Log(spriteRenderer == null);
        spriteRenderer.sprite = spriteArray[diceNumber];

I’m calling changeSprite from another script.
Thanks in advance

Ermiq found the mistake.
I created a new instance of ChangeSprite in the script I called the function in.
( ChangeScript changeSecSprite = new ChangeScript; )
By this I only called the function changeSprite and skipped the start and update method.
The fix is to grab the script via the game object like:

ScriptName scriptName = GameObject.Find("GameobjectItsAttachedTo").GetComponent<ScriptName>();

So in my case:

ChangeScript changeSecSprite = GameObject.Find("Dice").GetComponent<ChangeScript>();

Or by instantly calling the function from this:


Thanks a lot!!