in projects There are so Many Directories ,and i want each .py file in separate directory an import other file correctly.
I tried This
PREFIX = normpath(dirname(dirname(dirname(abspath(__file__)))))
if PREFIX not in sys.path:
sys.path = [PREFIX] + sys.path
when i want to import the other directories’ variables ,i just import this file.but it may be too verbose.
is there a better way to solve it in a better way(except the way that export the project’s path to the global system’s path)?
you could use python modules and import them like:
ex:
the folders are:
Like: https://github.com/masom/Puck/blob/master/client/pixie/controllers/configuration.py#L2