1. Import the module in Python: Import sys; the equivalent of importing packages, classes in Java.
For example, we import the SYS module, using: Import sys;
2. When calling a function in Python, the module you are calling is searched from the default configured library folder (Sys.path). The directory configuration for this library file is as follows:
The Sys.path is used to configure the Python module search path. It is a list that prints the contents of the default Sys.path:
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9, 10:37:12) [MSC v.1600 + bit (Intel)] on Win32
Type "Copyright", "credits" or "license ()" For more information.
>>> Import sys;
>>> print (Sys.path);
[', ' d:\\seleniumtestcase', ' c:\\python33\\lib\\idlelib ', ' c:\\python33\\lib\\site-packages\\ Setuptools-5.5-py3.3.egg ', ' C:\\python33\\lib\\site-packages\\pip-1.5.6-py3.3.egg ', ' C:\\Windows\\system32\\ Python33.zip ', ' c:\\python33\\dlls ', ' c:\\python33\\lib ', ' c:\\python33 ', ' c:\\python33\\lib\\site-packages ']
>>>
where ' D:\\seleniumtestcase ' is their own use of sys.path.apend (' d:\\seleniumtestcase '); Command added.
By adding a custom directory, you can import the module later, Python will go to you to add the source code to find the module.
Dive into Python: Import of modules and configuration of search file paths