Having trouble referencing a script

Can anyone tell me why I get an error from the following code?
I’m trying to reference a C# script (from another C# script in the same project) called HazardSpawner. I’m trying to de-activate it…

HazardSpawner hazardSpawner;


    void Awake ()
     {
		hazardSpawner = GetComponent <HazardSpawner> ();
		hazardSpawner.enabled = false;
     }

EDIT: here is the resulting error:

NullReferenceException: Object reference not set to an instance of an object
PlayerHealth.Awake () (at Assets/Scripts/PlayerHealth.cs:28)

They are on the seperate objects. Use the following:

GameObject.Find("HazardSpawner").GetComponent<HazardSpawner>().enabled = false;

The script you are using is searching the script component on the same gameobject.

Sorry. Should’ve added that to the post.

Here it is:

NullReferenceException: Object reference not set to an instance of an object
PlayerHealth.Awake () (at Assets/Scripts/PlayerHealth.cs:28)