[Tutor] How to import a module
Alan Gauld
alan.gauld at yahoo.co.uk
Wed Oct 28 17:23:44 EDT 2020
On 28/10/2020 17:37, Samira Schadt wrote:
> Dear tutor,
> I am trying to import a file ... it tells me it cannot find it.
Never summarise an error, always post the entire error
message, it is full of useful details.
Also if you have a problem with code show us the code,
don't make us guess.
If your class, MyClass is in a file called MyModule.py
then you should be able to import the class with
from MyModule import MyClass
Note no '.py' after the file name.
If thats what you are doing and you still get an error
then we need to see the detail.
--
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