Within a folder somedir
I have several directories dir1
, dir2
etc. and some files x.py
, y.py
, z.py
etc. In dir1
there are modules a
, b
, c
etc., module a
is used in module b
(like from a import somethings
) with no problem as usual.
But when I try to use any module say, a
within module x
and use this module x
within module z
, error occurs.
somedir/
|dir1/
| |__init__.py
| |a.py
| |b.py # from a import somethings / import a etc. -> ok
| |c.py
|dir2/...
|.
|.
|.
|x.py # from dir1.a import * or somethings -> error (`ModuleNotFoundError: No module named a`)
|y.py
|z.py # from x import * or somethings -> error (`ModuleNotFoundError: No module named a`)
I haven't created any packages neither want to, as I want to use this in an application program. Should I really make a package for this to work. How can I manage such imports. Please help.