anchor.diff:    cPyNone = 'None';
   
   implementation
  +
  +var
  +  PyLoadedModules: TStringList = nil;
  +  PyLoadedLocals: TStringList = nil;
  +
  +function IsPyLoadedModule(const S: string): boolean; inline;
  +begin
  +  Result:= PyLoadedModules.IndexOf(S)>=0;
  +end;
  +
  +function IsPyLoadedLocal(const S: string): boolean; inline;
  +begin
  +  Result:= PyLoadedLocals.IndexOf(S)>=0;
  +end;
  +
   
   procedure Py_SetSysPath(const Dirs: array of string; DoAdd: boolean);
   var
  
positive.code: 
    SObj:= '_cudacmd_' + AModule;
  
    if not ALazy then
    begin
      Str1:= 'import cudatext' + SLineBreak +
        Format('import %s',                [AModule]) + SLineBreak +
        Format('if "%s" not in locals():', [SObj]) + SLineBreak +
        Format('    %s = %s.Command()',    [SObj, AModule]) + SLineBreak;
      if UiOps.PyInitLog then
        Str1:= Str1+
        Format('    print("Init: %s")',    [AModule]);
      Str2:=
        Format('%s.%s(%s)', [SObj, ACmd, SParams]);
  
      try
        with GetPythonEngine do
        begin
          ExecString(Str1);
          Result:= EvalStringAsStr(Str2);
        end;
      except
      end;
    end
    else
    begin
      Str1:=
        'import cudatext' + SLineBreak +
        '_ = None' + SLineBreak +
        Format('if "%s" in locals():', [SObj]) + SLineBreak +
        Format('    _ = %s.%s(%s)',    [SObj, ACmd, SParams]);
  
      try
        with GetPythonEngine do
        begin
          ExecString(Str1);
          Result:= EvalStringAsStr('_');
        end;
      except
      end;
    end;
  end;
  
  function Py_rect(const R: TRect): PPyObject; cdecl;
  
negative.code: end;
  
  
  function Py_RunPlugin_Command(const AModule, AMethod: string; const AParams: array of string): string;
  var
    SObj, SCmd: string;
  begin
    SObj:= '_cudacmd_' + AModule;
  
    if not IsPyLoadedLocal(SObj) then
    begin
      if UiOps.PyInitLog then
        MsgLogConsole('Init: '+AModule);
      with GetPythonEngine do
      begin
        ExecString(Format('import %s;%s=%s.Command()', [AModule, SObj, AModule]));
      end;
      PyLoadedModules.Add(AModule);
      PyLoadedLocals.Add(SObj);
    end;
  
    try
      SCmd:= Format('%s.%s(%s)', [SObj, AMethod, Py_ArgListToString(AParams)]);
      with GetPythonEngine do
        Result:= EvalStringAsStr(SCmd);
    except
    end;
  end;
  