Is there any alternative to prevent typing repeated long paths while importing modules in python.
Current code:
from a.b.c.d.e.f.g import g1
from a.b.c.d.e.f.g import g2
from a.b.c.d.e.f.g.h import h1
from a.b.c.d.e.f.g.i import i1
I tried following code:
ref_path = a.b.c.d.e.f.g
from ref_path import g1
from ref_path import g2
from ref_path.h import h1
from ref_path.i import i1
But unfortunately it did not work. I cannot do from a.b.c.d.e.f.g import *
since there might be too many modules within the ref_path
.
If I am able to do this, I could easily maintain different common ref_paths
used in different modules from one common location with minimal efforts.