Run function with delay

Hello,

How can I make a function run automatically X seconds after another function has been run (with Pluto) ?

Thank you

Here is how to run f() again after 5 seconds. This will block:

julia> f(); sleep(5); f()
2021-04-16T10:39:55.302
2021-04-16T10:40:00.340

This will not block so other functions can run in the meantime:

julia> f(); @async begin
           sleep(5)
           f()
       end
2021-04-16T10:41:03.714
Task (runnable) @0x0000000073504650

julia> 2^9
512

julia> π
π = 3.1415926535897...

julia> 2021-04-16T10:41:08.722
1 Like