Help a beginner with a small doubt ?

I just started learning unity and now I just started learning UnityScript API’s.
In this below script I am able to do everything I am doing for the object and its working properly but in below the code I am trying to access function from another script and it shows me an error message.

“NullReferenceException: Object reference not set to an instance of an object
CubeBehaviour_01.Update () (at Assets/Scripts/CubeBehaviour_01.js:22)”

Here is the code

CubeBehavious.JS

var CubeSpeed = 1;

var accessVariable : GameObject;

function Update () {
	
	this.transform.Translate(0,0,Time.deltaTime*CubeSpeed,Space.Self);
	
	//Rotate the Object -> Cube.
	this.transform.Rotate(0,0,1);
	
	accessVariable.transform.Translate(0,0,Time.deltaTime*CubeSpeed,Space.Self);
	
	var accessScript = GetComponent(SecondScript);
	accessScript.newFunction("Hello");

	}

SecondScript.js
    
function Update () {
	
}

function newFunction (s : String)

{
	var newSpeed = 10;
	print("Hello World " + newSpeed);
}

this newFunction is the function I am accessing.

Sorry if this is a very basic question. I am just a beginner . Thank you for your time.

Is your script accessing another script that is present on the same game object in your Hierarchy view or from a different game object.

If the “SecondScript” is attached to a different game object then you are required to reference that and add getcomponent to that referenced gameobject after finding it.

For this code to work both scripts need to be attached to the same GameObject.

To get a script from another GameObject use Find