Pluto.jl
Pluto.jl copied to clipboard
cell order fails with import of local modules
Hello. It seems that import .LocalModule
does not calculate dependencies correctly. In the test notebook below, the module Test
line should be first in the Cell order, but it is last. I use this mechanism to include one notebook within another. This approach lets me reliably skip code in an included notebook by wrapping it with if parentmodule(@__MODULE__) == Main
test (it'd be lovely if this were a more explicit option).
### A Pluto.jl notebook ###
# v0.19.32
using Markdown
using InteractiveUtils
# ╔═╡ e2c216e8-38af-42cb-b4d4-042eab0f033b
import .Test: var
# ╔═╡ 4860c622-36b3-4529-a043-90112221c613
println(var)
# ╔═╡ 77714a5e-a57e-11ee-035e-2df7ef45c142
module Test
var = "Hello"
end
# ╔═╡ Cell order:
# ╠═e2c216e8-38af-42cb-b4d4-042eab0f033b
# ╠═4860c622-36b3-4529-a043-90112221c613
# ╠═77714a5e-a57e-11ee-035e-2df7ef45c142
A cousin of this one. I tried export
and using
.
This notebook also fails, although it decides the using
is another definition of the module, and disables it.
### A Pluto.jl notebook ###
# v0.19.32
using Markdown
using InteractiveUtils
# ╔═╡ 6ecb601e-a769-11ee-1263-23270413abcb
module Test
hello = "World"
export hello
end
# ╔═╡ f7fc12e9-6d45-482e-9152-190c50cfa1a6
using .Test
# ╔═╡ 11403621-8fff-474a-8e21-520aac7b75fc
hello
# ╔═╡ Cell order:
# ╠═6ecb601e-a769-11ee-1263-23270413abcb
# ╠═f7fc12e9-6d45-482e-9152-190c50cfa1a6
# ╠═11403621-8fff-474a-8e21-520aac7b75fc