pythonpython-2.7enumshoudini

Error defining Enum in class: TypeError: 'module' object is not callable


I have a Python package containing a module:

myPackage

|----> myModule

where I want to define an enum as a static property of the module. I'm using the enum34 module for Python 2.7 in Houdini

#myModule.py
from enum import Enum
class DebugStates(Enum):
    release = 1
    debug = 2

In another Python file i then try to import myModule:

#OtherPython.py
from myPackage import myModule

which is executed when Houdini starts up. This executes without errors, but when I try and pull up a Python console I get this error and Houdini crashes:

"Traceback (most recent call last):
  File \"<stdin>\", line 1, in <module>
TypeError: 'module' object is not callable
"

Solution

  • Le sigh, I just figured it out, I was changing my module names to protect the innocent in my question. In real life I was trying to call my module "globals" thinking that the package would act like a namespace boundary. Apparently not a good idea.