View Full Version : [Python]How do I import files from other directory

Mister LinOx
May 5th, 2009, 03:35 AM
Okay. I have been experimenting with python by creating some programs/scripts and then saving them to my documents/Python Files(created folder). The thing is, I have no idea how to import something OUT of the default python directory.

It was easier in XP, as the default save location was where the other modules were at. In Ubuntu, I can't seem to find this directory or where I should save the files to or how to import them. Help?

May 5th, 2009, 03:55 AM
import sys
import mymodule

May 5th, 2009, 04:10 AM
Or use distutils to install your module. It's gravy.

python myscript.py install


May 5th, 2009, 04:19 AM

Mister LinOx
May 5th, 2009, 12:26 PM
Ah, I see now. Thank you, guys.
I ended up using the:
sys.path.append way.

March 2nd, 2012, 08:02 PM
Thanks you, I've the same problem ;)

Tony Flury
March 3rd, 2012, 12:23 AM
Does import not follow symbolic links ? if so that might be an option.