# What triggers a "must be explicitly imported" error?

**URL:** <https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 26, 2017, 5:40am UTC](https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993 "2017-12-26T05:40:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [December 26, 2017, 5:40am UTC](https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993/1 "2017-12-26T05:40:49Z")

</div>

Let’s say you have a couple example files:

```julia
# woof.jl

function println(foo::Module, bar::AbstractString)
  "cool. cool. alright"
end

println() = println(Main, "huh?")

```

```julia
# bark.jl

println(a::Float64, b::Integer, c::String) = println(Main, c)

```

* * *

You now want to load them into a module, `Moo.jl`:

```julia
# moo.jl

module Moo
  cur_array = []

  cur_files = ["woof.jl", "bark.jl"]

  # for cur_file in cur_files
  # include(cur_file)
  # end

  for cur_file in cur_files
    open_file = open(cur_file)
    cur_expr = parse(open_file)
    while cur_expr != nothing
      push!(cur_array, cur_expr)
      cur_expr = parse(open_file)
    end
    close(open_file)
  end

  for cur_expr in cur_array
    Moo.eval(cur_expr)
  end
end

```

* * *

Why does this method of loading the files trigger an “explicitly define” error:

> `ERROR: LoadError: error in method definition: function Base.println must be explicitly imported to be extended`

Whereas using the standard `include(cur_file)` work perfectly?

// edit: `println` could have just as well been `print`, `read`, `countlines`, etc.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [December 26, 2017, 5:39pm UTC](https://discourse.julialang.org/t/what-triggers-a-must-be-explicitly-imported-error/7993/2 "2017-12-26T17:39:47Z")

</div>

If I copy the content into those filenames and do `include("moo.jl")` it works fine for me on 0.6.0 (and fails for unrelated reasons on trunk – 24455).
