ninia / jep

Embed Python in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot Import Custom Module

aghasemi opened this issue · comments

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):

  • OS Platform, Distribution, and Version: Ubuntu 22.04
  • Python Distribution and Version: 3.10.12
  • Java Distribution and Version: 21
  • Jep Version: 4.2.0
  • Python packages used (e.g. numpy, pandas, tensorflow): none

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.

Worked. Many thanks.