I have created a folder named "custom_module" and I have the __init__.py inside the folder which contains:
__all__ = [
'Submodule1',
'Submodule2'
]
From what documentation I read I should be able to call import custom_module and get access to the package, however this isn't happening. How can I make python recognize my package? I am using python 3.2
Update:
The package is not located in the python folder. How does the python environment find it, so I can successfully import it by name.
解决方案
sys.path holds the Python search path. Before trying to import your modules and packages, set it to include your path:
import sys
sys.path.insert(0, 'your_path_here')
import custom_module
More detail in the Python docs and in this question