How do I find which module exported a given method or variable?

How do I find which module exported a given method or variable?

Background:

  • I have a script MyScript.jl which works
  • I made MyModule that encapsulates some of it’s functions, and call them from MyScript2.jl
  • MyModule.foo() throwing “not defined” error
  • need to find what imports are missing in MyModule

Here is the error:

ERROR: UndefVarError: cm not defined
Stacktrace:
 [1] foo(::MetaDiGraph{Int64,Float64}, ::Array{Any,1}, ::String) at /home/me/MyModule.jl:200
 [2] top-level scope at /home/me/MyScript2.jl:135

Where MyScript2.jl:135 is:

draw(PDF(string(drnm,paths[i].flowsL,"_path.pdf"), 16cm, 16cm), ggp)
1 Like

The problem is that julia is giving you an error base on all the information it has. Literally cm is not defined, so julia can’t know what it is or where it come from. Anyway, from the context I think cm means centimeter. Using Measures.jl may solve your problem. Or maybe you can get it from the package that export draw that should import Measures internally. But this is just a guess, from the single line you provide.

1 Like

Thanks @josePereiro. What command can I use to find the package that exports draw (in this case I think it’s GraphPlot but in general I may not know)?

Try @which draw

3 Likes

works, thanks!

1 Like

parentmodule(draw)

3 Likes