How to use a function in a module without specifying the module name

I have the following folder and module

ExampleFolder
    - SampleModule.jl
- main.jl

main:

import .Example

function  main()
    println(Example.greet_user("Svetlana"))
end

main()

Is there a way I can say println(greet_user()) without doing Example.greet_user()? When you do it as Example.greet_user() does it avoid naming conflicts if the same method exists in another module?

yes, you need to export in the module and import in your code with using.

also yes

1 Like