Marco Gelli
Marco Gelli

Reputation: 349

Import problems python module

I'm working on a Python project where I have this folder structure:

enter image description here

I'm currently editing the operators.py file and I get this error when I try to import a class from the hooks.py file.

enter image description here

I really don't understand why I get this error since by putting the __init__.py file in the custom folder I should have turned it into a python module.

Upvotes: 0

Views: 53

Answers (2)

techws
techws

Reputation: 148

it seems your operators.py file is int the same module as hooks, so :

from .hooks import TrediWSHook

Upvotes: 0

Niel Godfrey P. Ponciano
Niel Godfrey P. Ponciano

Reputation: 10709

That sounds like a PyCharm issue, not actually Python. I assume dags is the root folder for your project. If that's the case, right click on it -> Mark Directory as -> Sources Root

enter image description here

Upvotes: 2

Related Questions