[Tutor] accessing modules found throughout a package?
Alan Gauld
alan.gauld at btinternet.com
Sun Oct 18 13:26:51 EDT 2015
On 18/10/15 16:33, Alex Kleider wrote:
>> How does one arrange so "the top level directory _can_ be found within
>> Python's path."?
>
> Is the answer to include the following at the beginning of each file?
>
> if not 'path/to/top/level/package/directory' in sys.path:
> sys.path.append('path/to/top/level/package/directory')
You could, but you can also add it to your PYTHONPATH environment variable.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list