Calling functon attached to another object (Javascript)

I have a very simple scene with two cubes (CubeA and CubeB)

Each cube has its own java script file attached to it (ScriptA and ScriptB).

Here's what I have so far

//ScriptA

ScriptB.Test();

//ScriptB

public static function Test() { print("Test called!"); }

I'd rather do something like this

//ScriptA

CubeB.Test();


Is anything like this possible?

A couple of ways -

var component : ScriptB; // assign in inspector

component = targetThing.gameObject.GetComponent( ScriptB ); // get from something you already have ("targetthing")

component.Test(); // call function

There are at least 2-3 more identical questions posted on this matter yesterday.

For a more detailed explanation you can check the answers for this question:

http://answers.unity3d.com/questions/29163/getcomponent-keeps-returning-null