# Cannot import function in Pluto

**URL:** <https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608>\
**Category:** General Usage\
**Tags:** pluto\
**Created:** [December 5, 2021, 11:38am UTC](https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608 "2021-12-05T11:38:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 5, 2021, 11:38am UTC](https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608/1 "2021-12-05T11:38:06Z")

</div>

Hi all,

I recieve an error indicating multiple function definitions when I import a function and define a method. The attached image shows a simple example. Am I doing something incorrectly?

 ![import](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f0576d702709830d1a09658103d3994114cd862.png)

**Version**

Julia 1.7  
Pluto 0.17.2

---

<div class="post-metadata">

**Author:** ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)\
**Post date:** [December 5, 2021, 12:13pm UTC](https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608/2 "2021-12-05T12:13:16Z")

</div>

All methods definitions for a specific function must be done in the same cell.  
(_Edit: now this is not always necessary, see further comments_)

For now, those statements have to be wrapped in a `begin...end` block:

```julia
begin
	import Distributions: rand
	function rand()
		
	end
end

```

[https://github.com/fonsp/Pluto.jl/issues/7#issuecomment-878417670](https://github.com/fonsp/Pluto.jl/issues/7#issuecomment-878417670)

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 5, 2021, 12:34pm UTC](https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608/3 "2021-12-05T12:34:22Z")

</div>

Thank you for your help!

I find this behavior to be somewhat odd. As the attached image shows, its possible to specify multiple methods in different cells if the function is not imported. That is why I had difficulty solving the problem. Another option is to specify the module directly, i.e. `Distributions.rand`.

 ![multiple_funs](https://global.discourse-cdn.com/julialang/original/3X/d/b/db0622c366fd5d72a6fbb986de2a4d75a4419c91.png)

---

<div class="post-metadata">

**Author:** ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)\
**Post date:** [December 5, 2021, 8:17pm UTC](https://discourse.julialang.org/t/cannot-import-function-in-pluto/72608/4 "2021-12-05T20:17:23Z")

</div>

Nice, the multiple methods definition in different cells has been solved:  
[https://github.com/fonsp/Pluto.jl/pull/177](https://github.com/fonsp/Pluto.jl/pull/177)

The specific issue with import is  
[https://github.com/fonsp/Pluto.jl/issues/846](https://github.com/fonsp/Pluto.jl/issues/846)
