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 Instantiate

no able to import justMonster from my_monster

not able to import from my_monster import Monster

my_monster.py

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

In order to use "from my_monster import Monster", you need the following:

  • the file my_monster.py must be in the same directory as the file using this import, or located on the module search path
  • In the file my_monster.py there must be an object called "Monster"

Does your situation match this or do you have something different?

If you are still having problems, please post your my_monster.py file and the file in which you are using the import statement.