Question: I have the following project structure:

```
stages
--Transform
----__init__.py
----Transformer.py
----PDFTransformer.py
core.py

```

I would like to import PDFTransformer like this:

```
from stages.Transform import PDFTransformer

```

Therefore I have created `stages/Transform/__init__.py` with the following content in it:

```
from .Transformer import Transformer
from .PDFTransformer import PDFTransformer

```

But python interpreter throws the following error (in PDFTransformer.py):
`ModuleNotFoundError: No module named 'Transformer'`

The PDFTransformer.py includes the following:

```
import Transformer

class PDFTransformer (Transformer):
    pass

```

What I`m doing wrong?

Answer: 
If you ask Python to `import Transformer` from `PDFTransformer.py`, but when `PDFTransformer.py` is imported from `core.py` - i.e. when `core.py` is the `__main__` file - then the `import Transformer` is relative to `core.py`

In other words it is as if you wrote `import Transformer` in `core.py`. That obviously wouldn't work.

Instead in `PDFTransformer.py` put `from . import Transformer`, and it will import `Transformer.py`
add `__all__ =['Transformer', 'PDFTransformer']` in `stages/Transform/__init__.py` file.

so this `__init__.py` file would be like

```
from .Transformer import Transformer
from .PDFTransformer import PDFTransformer
__all__ =['Transformer', 'PDFTransformer']

```

this tell the python to load these function when you do `from stages.Transform import PDFTransformer`