Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Project1
----package1
------__init__.py
------module1_1.py
------module1_2.py
----project2
------package2
--------__init__.py
--------module2_1.py
--------module2_2.py

The structure is similar as the above, I want to import module2_1 in module1_1.py, is there any way?

I tried to add __init__.py under project2, it does work for import module1_1 in module 2_1, but in project2, such as in module2_2.py, that is unable to import module2_1. Anyone knows any other way? BTW, my python version is 2.7.
Posted

1 solution

This[^] documentation might just help you.

Some more -
Python packages[^]
Python packages and you[^]
 
Share this answer
 
v2
Comments
Richard MacCutchan 28-Apr-15 9:38am    
Pythin: is that just a small snake? :)
Abhinav S 28-Apr-15 9:44am    
Taken care of :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900