%someObject = new ScriptObject();

schedule(1000, 0, function(%obj) {
   %obj.delete();
   echo("Object deleted!");
}, %someObject);