Calling external functions from script methods

Hi. I’m new in Pascal Script. I have a problem with calling functions from script methods. For example:

Sender.AddMethod(Self, @TfrmMain.ScriptDeleteFile, ‘procedure DeleteFile (const strFileName: string);’);

//…
procedure TfrmMain.ScriptDeleteFile(const strFileName: string);
begin
DeleteFile(strFileName);
UpdateLog(‘File deleted’);
end;

//…
procedure TfrmMain.UpdateLog(const strLogMessage: string);
begin
if stScriptLogFile <> nil then //Here I have a problem. stScriptLogFile is nil, but I initialized it before
stScriptLogFile.Add(FormatDateTime(‘yyyy-mm-dd hh-mm-ss’,Now)+’ - '+strLogMessage);
end;

What I’m doing wrong?

Hello,
Can you send us a small testcase? We will test it.