import from a file in a subdirectory

holger krekel pyth at devel.trillke.net
Tue Apr 30 15:38:02 EDT 2002


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





More information about the Python-list mailing list