[Tutor] Regarding importing from a sub-directory

Alan Gauld alan.gauld at yahoo.co.uk
Sat Feb 10 04:19:20 EST 2024


On 10/02/2024 03:18, Phil wrote:
> There's no need Alan, to post either of my previous messages to the 
> list. I have discovered the answer to the problem. It's IDLE that's the 
> problem. VS Code does not have a problem importing from a sub_directory.
> 
Since I took you off moderation a while back I no longer see the
messages so they all get posted, including this one! :-)

However the IDE is not the answer to the problem since they are
only used in development. What you need to check is that the
import works when you run the code directly in Python,
ie without any IDE.

I suspect the real solution is for you to modify the PYTHONPATH
or sys.path values to include ~/Python.

-- 
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