import from a file in a subdirectory

bob ackerman rdacker at pacbell.net
Tue Apr 30 17:12:05 EDT 2002


On Tuesday, April 30, 2002, at 12:38  PM, holger krekel wrote:

> On Tue, Apr 30, 2002 at 12:27:03PM -0700, rdack wrote:
>> i have a script running in a directory.
>> i want to call a subroutine in a file in a subdirectory.
>>
>> in the first file i said  from subdir/ff.py import  subrtn
>> python doesn't like the slash.
>>
>> how do i do it?
>
> import sys
> sys.path.append('subdir')
>
> import ff
>
> --holger

yes. this works. thank you.






More information about the Python-list mailing list