[Tutor] importing path question
Kent Johnson
kent37 at tds.net
Sun Aug 10 19:56:42 CEST 2008
On Sat, Aug 9, 2008 at 6:03 PM, dave selby <dave6502 at googlemail.com> wrote:
> Hi all,
>
> I have a main directory 'kmotion2' where python scripts live. They
> access a library of scripts in 'kmotion2/core' as 'kmotion2/core' has
> a __init__.py file. However I now need to create a new directory
> 'utilities' inside 'kmotion2' that also needs to access scripts in
> 'core'
>
> kmotion2 directory
> | |
> core utilities
>
> So I need to import up the tree then back down. Is this possible ?
Yes, assuming kmotion2 is in your Python path (which it should be to
allow importing from core at all) you can just
import core.whatever
as usual.
Kent
More information about the Tutor
mailing list