How to use function from package directly?

Hello!

So I managed to follow the simple “Hello world!” example and then I managed to add my new source code. The name of the package is “PostSPH”. Whenever I try to use a function from there I have to do:

using PostSPH
PostSPH.function(input)

But how does something like, Dataframes, avoid this?

image

They don’t have to write Dataframes.Dataframe(…)

Kind regards

You’re looking for the export keyword:

module MyModule

export my_function

function my_function()
  println("hello")
end

end

The export my_function line means that anyone who runs using MyModule will be able to call my_function without needing to do MyModule.my_function.

2 Likes

Thanks! Will do it now, changed question title to better frame the issue for someone else in the future.

Kind regards