How to use JuliaCall?


I want to try JuliaCall but I’m finding the instructions extremely difficult to understand. This is my second attempt so I don’t remember well what I did in the first time. This time I managed to reach the point where I have this, which doesn’t look wrong since I want to try GMT.jl from Python.

>>> juliapkg.status(target=None)
JuliaPkg Status
Julia 1.8.0 @ C:\programs\julia-1.8\julia.BAT
  GMT: {'uuid': '5752ebe1-31b9-557e-87aa-f909b540aa54'}

But now how do I use the package? I have done from juliacall import Main as jl, but now how I start using it? How to call its functions? All I get is errors like:

>>> jl.using("GMT")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\joaqu\.julia\packages\PythonCall\H8yA3\src\jlwrap\any.jl:167", line 18, in __getattr__
AttributeError: Julia: UndefVarError: using not defined



Looking at the documentation, it looks like you should actually try:

from juliacall import GMT rather than the Main module.
Does that work any better?

Thanks for looking but unfortunately, nope

>>> from juliacall import GMT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'GMT' from 'juliacall' (C:\programs\miniconda3\lib\site-packages\juliacall\
jl.seval("using GMT")

seems to be the way it’s commonly done, for eg. the code in Step 4 of this guide for a different package says:

# Import `PostNewtonian` in the Julia session
jl.seval("using PostNewtonian")

Thanks, that worked. This info should really be available right away on the installing/using instructions.