Closed ArseniyKholod closed 1 year ago
Is it known behavior?
It is known in the sense that code is not evaluated in Main
(by design) but rather in a separate module.
Is there way around adding @MODULE?
Not from the LIterate side. The fact that include_trixi
defaults to main is either a feature or design flaw that you would have to discuss with Trixi developers. (A more intuitive behavior, IMO, would be to use a macro and default to the callers current module instead of Main
, for example.)
I've generated a documentation with Literate.jl.
make.jl
is executed:with
src/test.jl
:And UndefVarError with the
sol
variable occurs, thesol
is defined in the file joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl"). The full Stacktrace see at very bottom.The
trixi_include
does nothing else as calls theBase.include
with defaultMain
module.If I just execute the src/test.jl (meaning without using
Literate.notebook
). Code works perfectly.I found out, that adding
@__MODULE__
to src/test.jl solves that issue: Newsrc/test.jl
:1) Is it known behavior? 2) Is there way around adding
@__MODULE__
?Error Stacktrace: