Max Frai
Max Frai

Reputation: 64356

Python modules importing

I have folder with such structure:

parent/
   ---__init__.py
   ---SomeClass.py
   ---Worker.py

First file (__init__.py) is empty.

Second file (SomeClass.py) content is following code:

class Test:
   pass

Third file (Worker.py):

import SomeClass
Test()

ImportError: No module named SomeClass

What I do wrong?

Upvotes: 2

Views: 360

Answers (1)

Evpok
Evpok

Reputation: 4485

Try

from . import SomeClass

but remember you'll have to

SomeClass.Text()

instead of just Test()

Upvotes: 1

Related Questions