Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (1.6k points)

I am running Python 2.5.

This is my folder tree:




(I also have in each folder, omitted here for readability)

How do I import the nib module from inside the life module? I am hoping it is possible to do without tinkering with sys.path.

Note: The main module being run is in the ptdraft folder.

2 Answers

0 votes
by (25.1k points)

You need to add the directory that contains ptdraft to PYTHONPATH. You can do this by adding the location to ptdraft at the end of PYTHONPATH environment variable in you pc's properties.

0 votes
by (106k points)

You can use relative imports for the Python versions greater than 2.5:

from ... import nib

Related questions

Browse Categories