Export functions

I am using a package witten by someone. Somes functions are defined in the module, but not exported. I cannot invoke them in the REPL.

How can I modify the original codes to make these functions visible?

You can, but you may need to qualify the usage. For example, if M is the module, and n is the name in the module, access n from outside the REPL like M.n. You may also want to consult the documentation and check if the name is meant to be used outside of the package.

Not sure what you mean.

1 Like

Thank you very much! I actually find that it is nested. I have to invoke the function like

M.M1.fun
1 Like

You can also import the name specifically:

using HTTP
get("https://julialang.org") # gives an error
import HTTP.get
get("https://julialang.org") # returns the contents of the web page

For names like get this is probably something that should be avoided, but there can be situations with rarer names where this would be okay.

Edit: a better solution might be:

using HTTP
import HTTP.get as hget
hget("https://julialang.org") # returns the contents of the web page
2 Likes