Using `plotlyjs` backend inside Pluto notebook

I have a Pluto notebook that grew somewhat in size, and now I want to plot some data in it. If I give plotlyjs() backend selection command in notebook I get error saying PlutoJS could not be found in environment. Which, as I understand, is due to notebook having own environment

ArgumentError: Package PlotlyJS not found in current path:

  • Run import Pkg; Pkg.add("PlotlyJS") to install the PlotlyJS package.
  1. require (::Module, ::Symbol)@ loading.jl:967
  2. top-level scope @ backends.jl:660
  3. eval @ boot.jl:373 [inlined]
  4. _initialize_backend (::Plots.PlotlyJSBackend)@ backends.jl:659
  5. backend (::Plots.PlotlyJSBackend)@ backends.jl:176
  6. #plotlyjs#250 @ backends.jl:31 [inlined]
  7. plotlyjs @ backends.jl:31 [inlined]
  8. top-level scope @ Local: 1 [inlined]

But if I import both PlotlyJS and Plots, I get lots of namespace clashes.

Including the Pkg manually (as below ) disables established Notebook environment, and I get errors saying all previous imports are not available, and would require me to manually add and load in julia terminal.

begin
	import Pkg;
	Pkg.activate(Base.current_project())
	Pkg.instantiate()
	Pkg.add("PlotlyJS")
end

Error:

ArgumentError: Package SphericalHarmonics not found in current path:

  • Run import Pkg; Pkg.add("SphericalHarmonics") to install the SphericalHarmonics package.
  1. require (::Module, ::Symbol)@ loading.jl:967
  2. top-level scope @ Local: 1

Is there a workaround to it other than loading both libraries then using Plots.plot etc all the time?

I cannot use PlotlyJS.plot because that runs into WebIO error that has been reported on Github Issues.

One possible solution I could find was

using Plots
import PlotlyJS as pltjs

plotlyjs()

plot ...

Maybe this will help