Stop me if you've heard this one before: 'module' object has no attribute 'foo'

   2171   2   3
User Avatar
Member
140 posts
Joined: July 2005
Offline


I've got a bunch of defs in my HDA's python module, and one of them, regenTiles(), gets triggered by a button press callback.

Unless I allow edit, then open type properties and edit the PythonModule script in some way, then save the asset, regenTiles will always throw an AttributeError.

A long time ago, Rob Vinluan showed me a hackaround that put all the parms in a dictionary or something to wake them up, but I don't have access to that asset at my new workplace.

Is there a definite answer for why this happens and how to prevent it in the future? How do I make sure that my asset initializes with all of the functions in the Python Module callable by parameter callbacks?
User Avatar
Member
129 posts
Joined: Oct. 2020
Offline
+1
https://www.youtube.com/channel/UC4NQi8wpYUbR9wLolfHrZVA [www.youtube.com]
User Avatar
Member
253 posts
Joined: July 2013
Offline
I use this all the time and it works just fine. How did you setup the callbacks? Should be something like:

hou.pwd().hm().regenTiles(kwargs)
More code, less clicks.
  • Quick Links