Page 2 of 2

Re: Drop callbacks to execute Python function

Unread postPosted: Thu May 09, 2019 12:41 am
by sam
Yes it's the ID 6138 (but it was submitted prior the Feature Request Tracker, so it's not visible)

Re: Drop callbacks to execute Python function

Unread postPosted: Thu May 09, 2019 7:36 pm
by mati
Thanks Sam. An item creation callback is the big one for us, but this would also be a more robust solution than what I've seen suggested on this forum for save/saveAs/import/reference hooks.

Registering a callable object like OP's example would be best, but if that's not possible, a module path + function (or callable) would be preferred over a script path like I've seen elsewhere in the API:

e.g.

python code

register_item_creation_callback('path.to.module', 'handle_item_creation')


Then in path.to.module:

python code

def handle_item_creation(item):
# Do something about the created item.


Thank you.