I am very new to Julia. I would like to use python module from another directory. I have looked all over for instructions but none of them seem to work for me. Could someone please give me step by step instructions from using PyCall onward.
You’d better write an example which is not working, so people can help you achieve your goal.
1 Like
You could push the directory to Python’s sys.path
and then import the module:
using PyCall
push!(pyimport("sys")."path", "/path/of/directory")
mymodule = pyimport("mymodule")
4 Likes
I have put the path to by environment variable and I also can look it up in my julia session with
using PyCall
sys = pyimport("sys")
println(sys.path)
but I still get the following error during the import
pyimport("MyModule")
ERROR: PyCall.PyError("PyImport_ImportModule\n\nThe Python package MyModule could not be found by pyimport
In addition the import of the module in Python works. What I have to do?
For me the problem was solved by downgrading the Python version of 3.7 to 3.6 (Interacting with Python - TechyTok)