Importing Python sympy module into Julia

Viewed 100

I have a Julia module in which I would like to import the Python function sympy.physics.wigner.wigner_9j. My minimal example module is as follows:

module my_module

using PyCall
using SymPy
export test

test()=sympy.physics.wigner.wigner_9j(1,1,1,1,1,1,1,1,1)

end

Then in my Julia notebook running:

using my_module
test()

gives

KeyError: key :physics not found

However adding to the notebook

@pyimport sympy.physics.wigner as sympy_wigner
sympy_wigner.wigner_9j(1,1,1,1,1,1,1,1,1)

gives the correct output. For some reason using @pyimport inside modules gives errors, which I typically avoid by using an __init__ inside my module, e.g adding to my_module.jl

const camb=PyNULL()

function __init__() # this should probably go in SFBBispectrum.jl
    copy!(camb, pyimport_conda("camb", "camb", "conda-forge"))
    pars=camb.CAMBparams()
end

which allows me to access camb.CAMBparams. Unfortunately I am failing to do something similar for sympy.physics.wigner.wigner_9j.

1 Answers
Related