kanna
kanna

Reputation: 1450

PyDev - unable to import modules which are under sub directory

I have a python project structure shown below,

├── example
    ├── test.py
    └── module
        ├── __init__.py
        ├── mymod.py
        └── submod.py

I imported above project into a pyDev project and test.py could not import mymod. I was importing module inf following way.

from module import mymod

I added module directory to pyDev PYTHONPATH but that did not hep.

I could run the test.py from console without any problem.

Upvotes: 0

Views: 496

Answers (2)

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25332

As @Giacomo d'Antonio said, you have to add 'example' to the PYTHONPATH (and if you had added 'module' to the PYTHONPATH you should also remove it).

Upvotes: 0

Giacomo d'Antonio
Giacomo d'Antonio

Reputation: 2275

Add example to the python path

Upvotes: 1

Related Questions