Using PyCall inside Julia module

Viewed 211

I am trying to use the Python module camb which contains the function CAMBparams in Julia via PyCall. The following minimal example code works in a Jupyter notebook:

using PyCall
camb=pyimport("camb")

function test()
   pars = camb.CAMBparams()
end 

test()

I try to do the same thing inside my module my_module like so:

module my_module

export test

using PyCall
camb=pyimport("camb")

function test()
   pars = camb.CAMBparams()
end 

end #end of module

OK, now inside my Jupyter notebook, which is in the same folder where my module script is saved, I do:

using my_module
test()

and I get the error: ArgumentError: ref of NULL PyObject. I attempted what is suggested here: https://github.com/JuliaPy/PyCall.jl#using-pycall-from-julia-modules, but that did not fix my problem.

0 Answers
Related