Inconsistent Pluto behaviour - some cache to clean?

Hi,
Using WGLMaki in Pluto and tried following the thread here
My issue is that I seem to get different behaviour in different workbooks.
Starting a fresh workbook and adding the minimal example of

using WGLMakie, JSServe
Page()

and
scatter(1:4)
in separate cells work, producing the expected plot.

However, adding this at the beginning of another workbook that is “kind of” working in that it does produce plots but requires eg scatter to be prefixed as WGLMakie.scatter(1:4) does not work, complaining about both Page and scatter being undefined.

Had similar behaviour with other workbooks before where one worked (producing plots) the other did not - but copying cell by cell from non-working to working workbook did work. (Phew, that’s s lot of work…:wink:

So I start to wonder if there is some non-obvious cache or other state in a workbook that may need clearing to sort this out? Having to copy things into a working “seed” workbook does not really feel like a viable option for more than a very small proof of concept.

Currently running

  [824d6782] JSServe v1.2.3
  [c3e4b0f8] Pluto v0.15.1
  [276b4fcb] WGLMakie v0.4.5

There shouldn’t be any hidden state/cache anywhere. You haven’t provided a reproducible example, but what you describe sounds like a simple name clash, i.e. in your “bigger” notebooks you are using more packages which export the same names as the functions you are trying to use. Example:

julia> using Plots, CairoMakie

julia> scatter(rand(10), rand(10))
WARNING: both CairoMakie and Plots export "scatter"; uses of it in module Main must be qualified
ERROR: UndefVarError: scatter not defined
1 Like

An additional point:
Page() is just manipulating a global state, but it has no explicit input/ output variable. Therefore, Pluto cannot determine when this function has to be executed.
To fix this, put it into a cell with other statements where the execution order is defined, e.g.

begin
using WGLMakie, JSServe # using statements are executed first
Page()
end

Yes, doing this (with begin/end in the first cell of the workbook)