calling a function from a script on a collsion object

on collision I want to call the function SpawnDefender() from the script SummonDefenderOnStand() . I am doing this by finding the gameObject of the collider and then using GetComponent to find the script and it’s function. However it does not find the function SpawnDefender().

Thanks in advance for any help.

private GameObject defenderStand;

			if (other.tag == "defenderStand")
				{
					defenderStand = other.gameObject.GetComponent<GameObject>();
					defenderStand.GetComponent<SummonDefenderOnObject>().SpawnDefender();
					defenderStand.SpawnDefender();
				}

Try this:

if (other.tag == "defenderStand")
{
  SummonDefenderOnObject defenderStand = other.gameObject.GetComponent<SummonDefenderOnObject>();
  if( defenderStand )
    defenderStand.SpawnDefender();
}