bloopiebloopie
bloopiebloopie

Reputation: 319

Where am I going wrong in importing a self made python class in a self made sub package?

Hi I'm new to python and I would appriciate a second pair of eyes on this. I am currently refactoring a project to make it extensible.

The interperter encounters an error in main.py when trying to import an object called IrishTimesEventHandler from module located in a different package:

from alexaevents.irish_times_event_handler import IrishTimesEventHandler
ModuleNotFoundError: No module named 'alexaevents.irish_times_event_handler'

Hear is a snap of my directory:

enter image description here

The import statment in main.py looks like this:

from alexaevents.irish_times_event_handler import IrishTimesEventHandler

I am in the midle of refactoring using PyCharm, but as far as I can tell there are no circular dependencies.

Upvotes: 1

Views: 99

Answers (1)

Emily Parker
Emily Parker

Reputation: 301

did you name the file name to irish_times_event_handler.py or irish_times_event_handler?

I think .py extension is required when you are importing a module

Upvotes: 3

Related Questions