Question says it all.
F.e. when you refer to an object with a class of the bge.types-module which would then read like bge.types.class.
Question says it all.
F.e. when you refer to an object with a class of the bge.types-module which would then read like bge.types.class.
No, modules are not classes. The class construct is essentially used to define a type, and you can instantiate types by calling them. You can not however call modules, and you cannot instantiate them at all.
You can think about modules as singletons: There can only ever exist a single instance of a module.
Modules can contain members that are types though, so essentially modules can contain classes.
Surprisingly, although the module type itself is defined in C, it is a type just like any other and you can even subclass from it:
>>> import types
>>> types.ModuleType
<class 'module'>
>>> class C(types.ModuleType):
def foo(self):
print("hello")
>>> my_module = C('my_module')
>>> my_module
<module 'my_module'>
>>>
Uses for this are strictly limited though I did for fun once write some code that would replace a class in sys.modules
with a subclass instance that was a copy of the original module but with support for getattr
.
In normal use there is precisely one module type: individual modules are instances of the module type not separate types in their own right.