Well in this case I think is understandable, I never used Atom but I believe when you run a file it just include
it in the current session, so you are defining a new module in Main
called HV04
. using MyPkg
means that you want to load a package from the environment and include it in the Main
module. In your case the package exist in the environment but you can’t include it in Main
due to the name conflict.
For instance, this is another scenario:
module A
export funA
funA() = println("Hi from A")
end
using A
# ERROR: ArgumentError: Package A not found in current path:
# - Run `import Pkg; Pkg.add("A")` to install the A package.
funA()
In this case the using
statement fails because no module/package A
was listed in the active environment. But I can do using .A
(note the dot, which mean current Module) to tell the load system you want the Main
version not the version listed in any environment. In this case all works and funA
is exported to Main
.
module A
export funA
funA() = println("Hi from A")
end
using .A
funA()
# Hi from A
Now that I see your code, I don’t see the definition of a function greet
, so the call error could be also expected.