How do I get a list of functions defined in a module?

#1

Is there a command in Julia 1.1 that lists all the methods that are available in a module?
e.g.

module MyMod
  test1() = 1
  test2() = 2
  test3() = 3
end

Which would return:

[test1,test2,test3]

1 Like
#2

I find this

names(x::Module; all::Bool = false, imported::Bool = false)

Get an array of the names exported by a Module , excluding deprecated names. If all is true, then the list also includes non-exported names defined in the module, deprecated names, and compiler-generated names. If imported is true, then names explicitly imported from other modules are also included.

As a special case, all names defined in Main are considered “exported”, since it is not idiomatic to explicitly export names from Main .

source

1 Like