I have three modules: A, B and C. Module C uses functions from A and B. However, when I try to load modules A, B and C and I try to use a function from C that employs functions from A or B, an error says that functions from A or B are not available.
I included import A: function1, function 2, ..." and import B: function3, function 4, …" in module C.
An example that should work in the REPL with Julia 1.0:
# define modules
module modA
export double
function double(x)
return 2*x
end
end
module modB
function timesThree(x)
return 3*x
end
end
module modC
using Main.modA
export combineFunctions
function combineFunctions(x)
x = double(x)
x = Main.modB.timesThree(x)
return x
end
end
# use modules
using .modC, Test
x = 10.
x = combineFunctions(x)
@test x == 60.
The REPL is a different beast, since it knows all about modules defined in itself. The problem only exists when creating a module as a package and trying to import other packages. Those need to be added in order for the environment of the other package to know about.