<[EMAIL PROTECTED]> schrieb
>>
>>> I have a function called 'test' defined in A.py.
>>> How can I call that function test in my another file B.py?
>>
>> In B.py:
>>   import A
>>   A.test()
>>
> 
> But Do I need to put A.py and B.py in the same directory?
No, but then you have to take certain precautions. (*)

> if not, where does python look for A.py ?
In the path defined by the (IIRC) PYTHONPATH (*)

> And do I need to compile A.py before I can import it to B.py?
No.

(*) you might want to read the fine documentation at
http://docs.python.org/tut/node8.html
which tells it much better than I do, and might give you 
some more ideas for googling.
I haven't had yet the necessity for cross-directory imports.

HTH
Martin



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

Reply via email to