Import from a file in current directory using PyCall

I run Julia from a folder which contains a Python file called GramSchmidt.py which I wish to import from using PyCall. I proceed as follows:

using PyCall
GramSchmidt = pyimport("GramSchmidt")

I however get an error that says ModuleNotFoundError("No module named ‘GramSchmidt’ "). How should I proceed to be able to import from a file in my current directory with pyimport?

The is explained in the PyCall README.

1 Like

Okay. Thanks. So the solution is

using PyCall
pushfirst!(pyimport("sys")."path", "");
GramSchmidt = pyimport("GramSchmidt");