just put the folder in the site-packages directory. i.e:
C:\PythonXY\Lib\site-packages
Note: you need to add an empty __init__.py file to the folder
Files named __init__.py are used to mark directories on disk as Python package directories.
If you have files:
C:\PythonXY\Lib\site-packages\<my_library_folder>\__init__.py C:\PythonXY\Lib\site-packages\<my_library_folder>\module.py
you can import the code into module.py like:
from <my_library_folder> import module
If you delete the __init__.py file, Python will no longer search for submodules inside this directory, so attempts to import the module will fail.
If you have many folders, create an empty __init__.py file in each folder. eg:
C:\PythonXY\Lib\site-packages\<my_library_folder>\ __init__.py module.py subpackage\ __init__.py submodule1.py submodule2.py
suhailvs
source share