importing modules from higher level directory

Thomas Jollans thomas at jollans.com
Sat Jun 26 05:10:06 EDT 2010


On 06/26/2010 01:35 AM, Tom Pacheco wrote:
> from .. import module
> or
> from ..module import foo
> 
> this is intended for use within packages.

And it only works within nested packages.

Also, please refrain from top posting.

> 
> see
> http://www.python.org/dev/peps/pep-0328/
> 
> also search for
> python relative import
> 
> 
> - tom
> 
> Nathan Huesken wrote:
>> Hi,
>>
>> Is it somehow possible to import modules from *.py files in a higher
>> level directory?
>> Intuitively I would do
>>
>> import ../module
>>
>> but that does not work.
>> How does it work?
>>
>> Thanks!
>> Nathan
>>   
> 




More information about the Python-list mailing list