First, @tkf thank you very much for your suggestion!
I am developing a small simulation project (a dozen of files), currently completely in Python (numpy, scipy). I would like to port the project parts which perform the actual number crunching to Julia, and leave the rest of the project like input parsing and output presentation as it is just working (and as I’ve zero experience in Julia). I would like to do the port file by file.
Now, I need to import several Julia files/modules into a Python file, with a separate name space for each Julia file. Like following:
Python project:
PurePyMain.py
import pyscr1 as scr1
import pyscr2 as scr2
print(scr1.testf_1(2), scr2.testf_2(1))
pyscr1.py
def testf_1(x):
return x*0.1
pyscr2.py
def testf_2(x):
return x*0.2
Julia-in-Python project (what I want to have) :
PyJlMain.py
import jlscr1 as scr1
import jlscr2 as scr2
print(scr1.testf_1(2), scr2.testf_2(1))
Julia-in-Python project (what I got to work) :
JulPyMain.py
from pyjulint1 import Main as scr1
from pyjulint2 import Main as scr2
print(scr1.testf_1(2), scr2.testf_2(1))
julscr1.jl
function testf_1(x)
return x*0.1
end
julscr2.jl
function testf_1(x)
return x*0.2
end
pyjulint1.py
from julia import Main
Main.include("julscr1.jl")
pyjulint2.py
from julia import Main
Main.include("julscr2.jl")
So it works, but for every Julia file that I want to import to Python I have an additional Python file as an interface between both.
It there probably a more elegant way?