Hello,
I have just started programming in Python, and I ran into a problem
I want to import a module which is not in the same directory as my current module...
Directory structure is like this: -
A--
--help.py
B--
--two.py
Now, two.py and help.py are in two parallel directory... I want to use help.py in two.py..
I have found one way to do this by adding following lines to two.py: -
But I don't want to do this in every python module I make..
I python documentation I read that, sys.path is " Initialized from the
environment variable PYTHONPATH, plus an
installation-dependent default."
Now, as I get from this statement.. PYTHONPATH is an environment variable set to the path where my module is stored..
But, even when I have set this environment variable, I cannot get it work..
Can anyone tell, how I can set the variable.. (Like we set classpath in
Java)??