# Understanding/fixing delayed trigger of Revise.revise in manual mode

**URL:** <https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661>\
**Category:** General Usage\
**Tags:** question, development, revise\
**Created:** [December 24, 2019, 4:01pm UTC](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661 "2019-12-24T16:01:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![garborg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garborg/32/11446_2.png) [@garborg](https://discourse.julialang.org/u/garborg)\
**Post date:** [December 24, 2019, 4:01pm UTC](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661/1 "2019-12-24T16:01:07Z")

</div>

I’m having trouble getting `Revise.revise()` to take effect (right away) when either called in a loop, a script, or a wrapper function that also calls the (non-inlined) function that needs revising.

I put together a self-contained example – hoping someone can explain what’s happening / how I should be approaching this.

Use case detailed [here (ReviseLoop.jl)](https://github.com/garborg/ReviseLoop.jl).

Script with tests enumerating the unexpected behavior [here (ReviseLoop.jl/src/script.jl)](https://github.com/garborg/ReviseLoop.jl/blob/master/src/script.jl)

Any idea why the test marked “Issue ‘1’” is failing when run as a script vs in the repl, and why “Issue ‘2’” shows the update is not reflected until the function is called twice?

I’m sure this is easy to do right and I’m just missing something.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [December 24, 2019, 5:14pm UTC](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661/2 "2019-12-24T17:14:24Z")

</div>

Try replacing `f(args...; kwargs...)` with `Base.invokelatest(f, args...; kwargs...))`. I believe you have world age issues, rather than Revise issues.

---

<div class="post-metadata">

**Author:** ![garborg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garborg/32/11446_2.png) [@garborg](https://discourse.julialang.org/u/garborg)\
**Post date:** [December 24, 2019, 6:56pm UTC](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661/3 "2019-12-24T18:56:26Z")

</div>

@cstjean Thank you!

`invokelatest` cleared up Revise’s behavior for me in the REPL, but not when running the same script non-interactively ([https://github.com/garborg/ReviseLoop.jl/blob/invokelatest/src/script.jl](https://github.com/garborg/ReviseLoop.jl/blob/invokelatest/src/script.jl)).

I read up on the basics of world age in a repl context here [manual/methods/#Redefining-Methods-1](https://docs.julialang.org/en/v1/manual/methods/#Redefining-Methods-1), but I think I still need to figure out the interplay between world age, invokelatest, and scoping outside the REPL.
