1 of 2

Why can't I call theme functions declared in template.php in mymodule_nodeapi hook?

I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!