Pages

Jun 24, 2015

Import a module from your package in Python

If I have two modules in two packages in the same folder described below:
myfolder/
        package1/
                __init__.py  (need to add an empty file)            
                module1.py (has a function test())
        package2/
                __init__.py
                module2.py

I can use the following code in module2 to import module1

No comments:

Post a Comment