I have two python projects. The first one is a django project located at /path/to/project1/
and has below file structure:
project1/
|- policy/
|--- models.py
And I have another project, say project2
. Within this project, I'd like to import the some definition from project1.policy.models
. e.g.
sys.path.append('/path/to/project1/')
from policy.models import SomeModel
However, the issue is, in project2, there's also an directory named policy
, which result in an ImportError. I cannot rename either directory name of policy
.
I do try absolute import, i.e. from __future__ import absolute_import
but doesn't work.
BTW, my python version is 2.6.1