ninia / jep

Embed Python in Java
Other
1.27k stars 146 forks source link

Cannot Import Custom Module #514

Open aghasemi opened 5 months ago

aghasemi commented 5 months ago

Describe the problem Hello, Is there a special method for importing custom modules (i.e. Python files in the same directory) vs. ordinary, installed modules? I get "NoModuleFoundError" despite haveing the Python file in the same directory and making sure that both Java and Python are in the right "current directory".

Many thanks Best

Environment (please complete the following information):

bsteffensmeier commented 5 months ago

When embedding python the current working directory is not automatically added to the path. You can add the cwd to the path by adding "." to JepConfig.addIncludePath, or the PYTHONPATH env var or adding it to sys.path in the Interpreter.

aghasemi commented 5 months ago

Worked. Many thanks.