I have a collection of libraries in python that I need to have in a single zip file.
The structure is:
rootlib
|
--- lib_a
| |
| --- lib_a.py
|
--- lib_b
|
--- lib_b.py
I want to be able to reference lib_b from lib_a. When unzipped, I can load lib_b from lib_a.lib_a.py simply by doing:
from lib_b import lib_b
but when I zip up the rootlib folder and use it in a script like this:
import sys
sys.path.insert(0, '/home/myuser/rootlib.zip')
from rootlib.lib_a.lib_a import LibA
I get an error that says:
Traceback (most recent call last):
File "test.py", line 4, in <module>
from rootlib.lib_a.lib_a import LibA
File "/home/user/rootlib.zip/rootlib/lib_a/lib_a.py", line 3, in <module>
ImportError: No module named lib_b.lib_b
How do I reference/import the adjacent lib_b library from lib_a?