I don’t have time to dig into this in detail right now, but the short answer is that whenever you have problems with includet
you should consider separating your “code” (function definitions) and “script” (tasks you want to run) into separate files. You should includet
the functions and include
the script. (Or better, make the functions a package, so you get the benefits of precompilation.)
This comes down to the fact that includet
needs to be able to figure out what’s code-definition and what’s “work,” and run the code-definition in the interpreter and the work in the compiler (for reasons of performance, because the interpreter is really slow). Moreover, it needs to be extremely careful not to run certain kinds of things twice. Revise is already quite good at figuring these things out, but surely there are still some bugs and it’s fundamentally a hard (perhaps undecidable) problem. You can make its job easier by separating your code from your script-work and make sure it only tracks the former.