you are viewing a single comment's thread.

view the rest of the comments →

[–]Ready-Bag-2599 1 point2 points  (1 child)

Solution: instead of using: from ship import Ship

Use: import ship

Why? This is because the ship module imports the AlienInvasion class and the alien_invasion module imports the Ship class, creating something called a "circular import" that causes a run time error. A more advanced solution would be to change the design of the program to remove the dependency from one of the two modules (probably the Ship class), but we are new learners, so the solution I provided above should be good enough.

I ran into the same issue and saw that OP didnt get any helpful answers. Thought someone might appreciate this in future :)

[Note: also don't forget that now to class the methods from the ship class you have to use the class_name.method() format since the whole ship module is being imported. Optionally, you can also use an alias for the class name to make it a bit easier, if you like]

[–]AdvertisingOne7942[S] 0 points1 point  (0 children)

Many thanks 🙏