Lately I have been dealing with a situation where, I will try to call a function, whose definition only exists in a shelf item, via a hotkey or the script editor or in other places, etc etc. And I will end up getting an error:
// Error: Cannot find procedure "hello".
If this was an isolated instance, I would be fine with it but its something I am dealing with constantly, I have a few scripts I have bought/created that are only stored in shelf items. So this creates a problem where, if I have so far not called the function by clicking the shelf item, I will get an error.
A solution that comes to mind is to just copy and paste these definitions to the custom scripts (“hotkey editor” > “custom scripts”) window but this just moves the problem to another location. As I then, would not be able to call the procedure from the shelf, the script editor, etc etc.
I will have to
I am essentially asking for a design or a solution, where as soon as I start the Maya programme, I can call a procedure that is saved in the shelf from the script editor. Furthermore, avoid repetition work, where every time a developer updates their tools, I have to update it at multiple locations.
If such a feature is not available, then I would like to hear how you guys approach this issue, surely I am not the only one that has confronted it.
What I tired: I thought the global
keyword was for this very purpose. I tested it by saving a procedure in a shelf item and trying to call it in the script editor, and I get the above error:
global proc hello3(){
print("\n hello world \n");
}
hello();
Am on Maya 2025, thanks for any input.