Lets say that you are in directory "C:\\Python25" and you want to
import function "bar" defined in module "foo" located in your windows
desktop.
You do it like this:

>>> import sys
>>> sys.path.append('C:\\Users\\You\\Desktop')
>>> from foo import bar

So you add your desktop to "sys.path" and then import the function as
though it is in the same directory.
Hope this helps...
Luis


On 22 oct, 18:38, Kurda Yon <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to import a function from a file which is located not in
> the same directory as the main program (from which the function needed
> to be imported).
>
> Could anybody pleas tell me how to do that?
>
> Thank you in advance.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to