I have the following directory structure

RawRepo contains a simple class:
class RawRepo:
pass
init.py contains:
__all__ = ["RawRepo"]
And yap-analysis.py, my "main file", uses either of the following, but it doesn't work:
from yap import RawRepo
from yap import *
when I try to instantiate it, saying:
TypeError: 'module' object is not callable
How to make it actually work? I want yap to be the module, and RawRepo just one of its classes.
Import the class in yap/init.py:
from .RawRepo import RawRepo
Then you can import it in yap-analysis.py like this:
from yap import RawRepo
Note that you can group multiple classes in on module. You should also consider to rename the module to something like raw_repo to conform to PEP8, "modules should have short, all-lowercase names."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With