importing python file class instead from sibling directory instead of python module with same name?

42 views
Skip to first unread message

Sivanagamahesh Gorijala

unread,
Jan 3, 2018, 4:22:24 AM1/3/18
to Python Challenge
 Hi,
I have the following registry structure 

own_lib/ 

directory_a/ 

alib.py 

test/ 

b.py 

In b.py I have something like this for bringing in alib.py 

sys.path.append(os.path.abspath('../own_lib/directory_a/')) 

from alib import a_func 

In any case, my concern is that I have python module with same name alib introduced in my framework. Accordingly, b.py dependably imports introduced module as opposed to alib.py from kin index. In the event that b.py and alib.py are in the same index then it works fine yet not in the event that they are in various registries disregarding utilizing sys.path.append. I can't uninstall this module either change the name of alib.py. What will be the ideal answer for settling this mistake?

Thanks

Sivanagamahesh
Reply all
Reply to author
Forward
0 new messages