I am writing my first python script and this package/module thing has me going nuts. Lets start with my folder layout
builder.py
-buildModule\__init__.py
-buildModule\AppList.py
-buildModule\BuildClass.py
-buildModule\ConfigSystem.py
-buildModule\MenuSystem.py
-buildModule\Singleton.py
ok, so my __init__.py
looks like this
from ConfigSystem import *
from BuildClass import *
from MenuSystem import *
from AppList import *
from buildModule.Singleton import Singleton
Now, im trying to decorate my configsystem as a singleton so my singleton looks like
class Singleton:
def __init__(self, decorated):
self._decorated = decorated
def Instance(self):
try:
return self._instance
except AttributeError:
self._instance = self._decorated()
return self._instance
def __call__(self):
raise TypeError(
'Singletons must be accessed through the `Instance` method.')
and now, with my configsystem class, if im reading the manual correctly, this should work
import Singleton
@Singleton
class ConfigSystem:
but im getting
TypeError: 'module' object is not callable
I've read the module part of the manual several times now and im not quite getting it. Why isn't this working?
Is there a module/package tutorial out there somewhere that is written a bit clearer/differently than the manual?