Passing object to pascal script

Hello, im new to pascal script and delphi. Im trying to pass object from my app to the script but i cant make it. So im asking experienced people to help me.

this is what i have:

    function ExtendCompiler(Compiler: TPSPascalCompiler; const Name: AnsiString): Boolean;
var
	CustomClass: TPSCompileTimeClass;
begin
  try
    Compiler.AddDelphiFunction('procedure print(const AText: AnsiString);');

    SIRegisterTObject(Compiler); // Add compile-time definition for TObject



    CustomClass := Compiler.AddClass(Compiler.FindClass('TObject'), TPerson);

    Customclass.RegisterMethod('procedure setAge(AValue: Integer)');
    CustomClass.RegisterMethod('function getAge: Integer');

    Result := True;
  except
    Result := False; // will halt compilation
  end;
end;

so i can register my object and create it in my script but how to pass an existing object for example
John: TPerson;
and i want to pass John to my script and in script i want to set his age and so on…

I think its simple question and i hope i will get right answer

Thanks

Easiest: Expose a function like print, but one that returns your TPerson class.

solved with
AddImportedClassVariable(Compiler,‘PersonInDelphi’,‘TPerson’);

but thanks for your idea

THat works too. There’s some more info here: