Can't update value of var in another class

I have variable ‘capacity’ which is updating normally, but I can’t get an updated value in another class, but initial value is there. Help me :<

public class housingPanelScript : MonoBehaviour
{
    public Housing houseObj;
    public TextMeshProUGUI capacity_txt;
    public int capacity = 10;

    void Update()
    {
        capacity_txt.text = "max capacity: " + capacity.ToString();
    }

  // some code

    public void upgradeHouse()
    {
        capacity += 10;
        Debug.Log("capacity " + capacity);
    }
}

// Score is updating btw (ontriggerenter2d method)

public class Spawn : MonoBehaviour
{
    public GameObject man;
    int spwCount = 0;
    public housingPanelScript house;
    public Destroyer score;

    public void spawn()
    {
        if (score.i < house.capacity && spwCount < house.capacity)
        {
            Instantiate(man, new Vector2(-1, 1), Quaternion.identity);
            spwCount++;
        }
        else
            Debug.Log("not spwn " + house.capacity + " " + score.i);
    }
}

As I can see it you will get a “NullReferenceException”, right?

In your “Spawn” script add the “Start()” Method and than find the GameObject, where the Script is added and find the Script on this GO.

   void Start()
    {
        house = GameObject.Find(/*Tag of GO*/).GetComponent</*Your scripts name*/>(); 
    }