2👍
Try to move your julia import out of the class constructor and do not set self.jul
as the output of jl.include
:
# in script.jl
function hello()
return "hello"
end
# in code.py
import julia
julia.Julia()
from julia import Main as jl
class juliaStuff:
def __init__(self):
self.jul = jl
jl.include("script.jl")
def callJulFunc(self):
return self.jul.hello()
obj = juliaStuff()
print(obj.callJulFunc())
Calling the python code prints "hello" in the terminal.
Source:stackexchange.com