I have:
C:/Python27/site-packages
in my Path (as shown in the screenshot.)
I also have the folder pywinauto within C:/Python27/site-packages, so I have
C:/Python27/site-packages/pywinauto
That folder contains some modules which I use. For some reason I can import pywinauto by typing:
import pywinauto
but it's contents are not imported unless I explicitly say:
from pywinauto import <module>
I think I have everything setup correctly, is there anything that is being overlooked?
Modules internal to a package are not automatically imported when you import the package. When you import a package, only its __init__.py
gets executed. In many cases it contains nothing, but it's common to put there some definitions and other imports.
So, in pywinauto/__init__.py
, include this line:
import application
Then, this should work:
import pywinauto
print pywinauto.application
The alternatives are to import like this:
import pywinauto.application
Or like this (as you already suggested):
from pywinauto import application