I have a python script that I call from a custom control in ArcMap.
This script (x.py) contains a number of functions and is the main script I run.
I have another script (y.py) that I call from another control in ArcMap. In this script, I import x so I can leverage some of the functions in x.py.
Unfortunately when I execute y.py it can't locate x to import it.
Both of these scripts are in the same directory.
I did some reading (http://docs.python.org/2/index.html) and discovered that I can set a variable called PYTHONPATH to point to this directory and this should automatically be appended to sys.path; and thus it's my understanding that it should then be able to find the script to import.
But alas, it did not work.
I do have a work around but that would mean repeating the same functions in each script and I'd prefer to avoid that duplication if possible.
Any help is appreciated.
b
This script (x.py) contains a number of functions and is the main script I run.
I have another script (y.py) that I call from another control in ArcMap. In this script, I import x so I can leverage some of the functions in x.py.
Unfortunately when I execute y.py it can't locate x to import it.
Both of these scripts are in the same directory.
I did some reading (http://docs.python.org/2/index.html) and discovered that I can set a variable called PYTHONPATH to point to this directory and this should automatically be appended to sys.path; and thus it's my understanding that it should then be able to find the script to import.
But alas, it did not work.
I do have a work around but that would mean repeating the same functions in each script and I'd prefer to avoid that duplication if possible.
Any help is appreciated.
b