Deleting an imported file within script

Below is my script. Everything works except removing the file. I have tried many things and just cannot get it to delete. If I run:

:delay 10; /file remove [/file find name=queue.rsc]

from the terminal it deletes fine.


:if ([:len [/file find name=queue.rsc]] > 0) do={
:foreach queue in [/queue simple find] do {
/queue simple remove $queue
}

/import queue.rsc
:delay 10; /file remove [/file find name=queue.rsc]
}

which version are you using, 2.9 or 3.0?

Version 2.9.43

On v2.9.43 it works for me:

/file print file=test;
:delay 1;

:if ([:len [/file find name="test.txt"]]>0) do={
     /file remove [ /file find name="test.txt" ] ;
}

When I do it that way it works as well. This makes me think it is a delay issue. When I run it and check the jobs tab, it completes long before 10 seconds. Do I have something wrong in how I ask it to delay so that it can import the entire script first? It is importing about 510 lines.