2013-05-31, 19:07
I am aware that you can make third-party libs (or your own libs) as a module so that other addons can use it. However, some libs are not commonly required by other addons, and you want to just bundle it with your own addon (without creating an external module). In the docs, it is stated that the own/third-party libs should be inside "PLUGIN/resources/lib". However, when I copy and paste a complex third-party lib (multiple files/sub-dirs/sub-modules) inside this directory, and try to import it with
The import statement works fine, however, any further internal imports inside the third-party libs generate exceptions (due to non-existing module/class/method). This is probably due to the fact that they are not in the root point for the plugin. If I adjust the imports inside the libs, they work, but require a lot of work (and you cannot do that each time you update the lib, or add a new lib).
If, however, I place the third-party lib right in the root directory of the plugin itself "PLUGIN/" (right beside default.py), then there is no problem anymore (especially for internal imports for the complex third-party libs).
Is there a way to place third-part libs inside "PLUGIN/res[/code]ources/lib" (or any other dir for that matter) without missing the import for these libs?
Code:
from resources.lib.MODULE import CLASS
If, however, I place the third-party lib right in the root directory of the plugin itself "PLUGIN/" (right beside default.py), then there is no problem anymore (especially for internal imports for the complex third-party libs).
Is there a way to place third-part libs inside "PLUGIN/res[/code]ources/lib" (or any other dir for that matter) without missing the import for these libs?