# Unable to use PlutoUI elements whilst using Pkg() to activate local env

**URL:** <https://discourse.julialang.org/t/unable-to-use-plutoui-elements-whilst-using-pkg-to-activate-local-env/128579>\
**Category:** New to Julia\
**Tags:** pluto, plutoui\
**Created:** [April 30, 2025, 3:24pm UTC](https://discourse.julialang.org/t/unable-to-use-plutoui-elements-whilst-using-pkg-to-activate-local-env/128579 "2025-04-30T15:24:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koustubh\_Jain](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/koustubh_jain/32/216598_2.png) [@Koustubh\_Jain](https://discourse.julialang.org/u/Koustubh_Jain)\
**Post date:** [April 30, 2025, 3:24pm UTC](https://discourse.julialang.org/t/unable-to-use-plutoui-elements-whilst-using-pkg-to-activate-local-env/128579/1 "2025-04-30T15:24:03Z")

</div>

Hi all, I am new to Julia and trying to migrate my workflow from MATLAB to Julia. There is package I need to use which is not there in the pkg registry. I had looked up that one can add pkgs to local envs simply by adding their git URLs. The pkg works fine both in a .jl file in VScode/codium and Pluto. To use the same set of pkgs in the Pluto Notebook (located in the same directory as my .jl file), I am using the following block:

```julia
begin
	import Pkg
	Pkg.activate("{path-to-my-project folder}")
	Pkg.add("PlutoUI")
end

```

Checking whether PlutoUI actually gets added to my project via Pkg.Status() tells me that it is indeed added to my env and should be working!

But when I try to use elements like Slider via `@bind` it doesn’t work and I instead get the following error

```julia
UndefVarError: `Slider` not defined in `Main.var"workspace#86"`
Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from.
Hint: a global variable of this name may be made accessible by importing Makie in the current active module Main
Hint: a global variable of this name may be made accessible by importing CairoMakie in the current active module Main
Hint: a global variable of this name may be made accessible by importing PlutoUI in the current active module Main

```

Here is my Pluto Notebook Code for reference (as a new user I can not upload it as a .jl file)

```julia
### A Pluto.jl notebook ###
# v0.20.8

using Markdown
using InteractiveUtils

# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
    #! format: off
    return quote
        local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
        local el = $(esc(element))
        global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
        el
    end
    #! format: on
end

# ╔═╡ d126bd7a-c8fc-4a41-a456-497bd18804e5
begin
	import Pkg
	Pkg.activate("/home/koustubh/Documents/Analog_IC_Design/AIC_S25/Project")
	Pkg.add("PlutoUI")
end

# ╔═╡ 020ca5ce-caf6-494f-acc7-6eb07f6ceed1
using PlutoUI

# ╔═╡ 937172cf-a4d3-48e0-af65-edf4d3cd27e4
begin
	using Gm_ID_kit
	using CairoMakie

	nch = ParseMAT("nmos18_TT_NOM.mat","nmos18_1");

	# Plotting GM_ID and fT curves against VGS
	L = collect(0.2:0.1:0.5); #in um
	VDS = 0.5;
	VGS = vec(nch["VGS"]); #in volts

	fT = LookUp(nch,"GM_CGG";VDS=VDS,VGS=VGS,L=L)/(2*pi);
	gm_id = LookUp(nch,"GM_ID";VDS=VDS,VGS=VGS,L=L);
	vth = LookUp(nch,"VT";VDS=VDS,VGS=VGS,L=L);

	f1 = Figure()
	ax1 = Axis(f1[1,1],ylabel = "gm/ID (s/A)",xlabel= "VGS(V)")
	ax2 = Axis(f1[1,1],yscale=log10,yaxisposition= :right,ylabel = "fT (MHz)")
	
	hidexdecorations!(ax2)
	hidespines!(ax2)
	linkxaxes!(ax1, ax2)
	
	for i in 1:length(L)
	    fT_plt = fT[i,:,1,1]
	    lines!(ax2,VGS,fT_plt/1e6,linewidth=2)
	    gm_id_plt = gm_id[i,:,1,1]
	    lines!(ax1,VGS,gm_id_plt,linewidth=2)
	    vth_plt = vth[i,1,1,1]
	    vlines!(ax1,vth_plt,linestyle=:dash,color=:red)
	end

	f1
end

# ╔═╡ b2b86931-1d79-44d6-bd88-473111bddbe6
#Verify all the pacakges are loaded correctly
Pkg.status()

# ╔═╡ a8be77f3-5c68-43b5-a9d5-06b7c51c2285
vds = @bind x Slider(0:1.8,default=0.9)

# ╔═╡ 41825102-4aa9-4067-bdfc-51b427079295
print(vth[:,1,1,1])

# ╔═╡ Cell order:
# ╠═d126bd7a-c8fc-4a41-a456-497bd18804e5
# ╠═b2b86931-1d79-44d6-bd88-473111bddbe6
# ╠═020ca5ce-caf6-494f-acc7-6eb07f6ceed1
# ╠═a8be77f3-5c68-43b5-a9d5-06b7c51c2285
# ╠═937172cf-a4d3-48e0-af65-edf4d3cd27e4
# ╠═41825102-4aa9-4067-bdfc-51b427079295

```

---

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [April 30, 2025, 5:18pm UTC](https://discourse.julialang.org/t/unable-to-use-plutoui-elements-whilst-using-pkg-to-activate-local-env/128579/2 "2025-04-30T17:18:17Z")

</div>

I think you need to `disable in file` the `Pkg.activate` cell. But I’m not totally clear on what your setup and goal is. See if either of these links help you:

> [@How to handle dependencies with Pluto notebook as package source code?](https://discourse.julialang.org/t/how-to-handle-dependencies-with-pluto-notebook-as-package-source-code/122780):
>
> Continuing the discussion from [Transforming a Pluto notebook into a Julia package](https://discourse.julialang.org/t/transforming-a-pluto-notebook-into-a-julia-package/60789/16): I’m having trouble figuring out what I need to do to use Pluto notebooks as source code, especially regarding the package environment and Pluto’s package manager. Do I need PlutoDevMacros.jl and/or @skip\_as\_script? I see “skip\_as\_script” inside Pluto comments in the provided example notebooks, but I do not see the macro at all when viewed as a notebook. How did you add these special comments? Is there document…

> [@Generate PDF document showing the equations in a package](https://discourse.julialang.org/t/generate-pdf-document-showing-the-equations-in-a-package/91064/3):
>
> I updated my package to go back to Pluto. It’s actually very easy. Pluto notebooks are just .jl files after all, so they can be include-ed as src files in a package. Then you can export the Pluto notebook as a PDF or HTML, either manually or with PlutoSliderServer.jl. The only [trick](https://discourse.julialang.org/t/how-to-handle-dependencies-with-pluto-notebook-as-package-source-code/122780) is to disable Pluto’s own package manager in the notebook by including a cell with the following content and then choosing “disable in file” in the cell menu options. begin import Pkg Pkg.activate(Base.current…

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [April 30, 2025, 5:53pm UTC](https://discourse.julialang.org/t/unable-to-use-plutoui-elements-whilst-using-pkg-to-activate-local-env/128579/3 "2025-04-30T17:53:21Z")

</div>

> [@Koustubh\_Jain](#):
>
> `Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from.`

This seems to be the case. Seems like CairoMakie.jl also exports a [Slider](https://docs.makie.org/stable/reference/blocks/slider#slider) of its own.

The “Try explicitly importing it from a particular module” advice is probably neater in the long run, I believe that should mean you should change the `using PlutoUI` cell into:

```julia
begin
    using PlutoUI
    using PlutoUI: Slider
end

```
