If you put the module files in a directory, for example external_modules/
, and then use sys.path.insert(0, 'external_modules')
you can include the module as it would be an internal module.
You would have to call sys.path.insert
before the first import of the module.
Example: If you placed a "module.pyd" in external_modules/
and want to include it with import module
, then place the sys.path.insert
before.
The sys.path.insert()
is an app-wide call, so you have to call it only once. It would be the best to place it in the main file, before any other imports (except import sys
of course).