Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imported juliacall.newmodule() namespace not updated #92

Closed
charstnut opened this issue Jan 8, 2022 · 1 comment
Closed

Imported juliacall.newmodule() namespace not updated #92

charstnut opened this issue Jan 8, 2022 · 1 comment

Comments

@charstnut
Copy link

It seems that in python, using command juliacall.newmodule() does not update the python namespace after importing a new module in julia.

MWE:

>>> import juliacall; pkg = juliacall.newmodule("Pkg")
Querying Julia versions from https://julialang-s3.julialang.org/bin/versions.json
Found Julia 1.7.1 at 'julia'
>>> pkg.status()  #Pkg.status() should work
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/char/repo/PythonCall.jl/src/jlwrap/any.jl:167", line 18, in __getattr__
AttributeError: Julia: UndefVarError: status not defined
>>> pkg
<jl Main.Pkg>
>>>

Proposed temporary workaround is to just use Main.seval() for now, but as noted in documentation it would be great to have the ability to call functions directly from imported julia modules.

@cjdoris
Copy link
Collaborator

cjdoris commented Jan 8, 2022

newmodule creates a new module with the given name, unrelated to any other module with that name. It's similar to doing module Pkg; end in the Julia REPL.

The current recommended way to import a module is to use seval.

@cjdoris cjdoris closed this as completed Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants