Hello,
I have a plugin that contain multiple subplugins (.pyp files) and want to know how to insert my lib modules to the system path and that affect all the plugin .pyp files. (I have already seen the post: External dependencies: The right way to do and I did not find an answer concerning this point )
lib\n module1.py, module2.py, module3.py,...
res\n <resource files>
plugin_1.pyp
plugin_2.pyp
plugin_3.pyp
...
Must I use the "sys.path.inser()" method on each of my subplugins?
I noticed that the subplugins is loaded one by one and in alphabetical order. so, for a test I created a new file and I rename it "a.pyp" (to be loaded in the first) and then I put inside it the following code:
import os
import sys
dirname = os.path.dirname(__file__)
lib_path = os.path.join(dirname, 'lib')
sys.path.insert(0, lib_path)
This it works, and affect all the .pyp files of my plugin.
Is there a right way to do that?
Thanks.