Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python (retired) Objects Create a Class with an Attribute

ImportError: No module named 'monster'

Hi There! I have problem importing Monster to my IDLE workspace.

Here is my error:

from monster import Monster Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> from monster import Monster ImportError: No module named 'monster'

My IDLE session can not find the class Monster. I need to know where do I need to save my class Monster script.


5 Answers

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Nitin.

With the hints that you have written I would presume that your Monster class definition is in a file called monster.py. Is this the case?


Hi Vittorio,

Yes, the file is called monster.py as the lesson shows. The IDLE is setup in windows 8.1.

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

I presume that if the monster.py file is in the same folder as the app you are running it should work fine.

How have you organized the project? Do you have folders and subfolders?

yes, monster.p;y is in the same folder as where I run the app.

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Can you show me the code from monster.py?