scripting problems with editorGUI

hello.

I asked a question a few days ago here

and i got this answer:

using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Scale))]
public class ScaleEditor : Editor
{
 public override void OnInspectorGUI()
 {

        base.OnInspectorGUI();
        if (GUILayout.Button("My editor button"))
        {
            myFancyFunction();
        }
 }

}

I have a deferent script(javascript) named Scale and I need to edit this script to call a function from it. this probably seems like a noob question but I need help.

thanks

The Editor class has a member called target which refers to the item being edited. So you can do something like:

public override void OnInspectorGUI()
{
  Scale scaleBeingInspected = target as Scale;

  DrawDefaultInspector();
  if (GUILayout.Button("My editor button"))
  {
     scaleBeingInspected.SomeFunction();
  }
}