-
Notifications
You must be signed in to change notification settings - Fork 22
Custom Function Calls
maybites edited this page Nov 20, 2022
·
4 revisions
There are two ways to execute custom functions like this one:
'''
functions used by message handlers
'''
import bpy
def my_function(address, args):
print("my_function received :",address, args)
This is the recommended way, because the script is parsed only once and thus the execution is very efficient.
where:
datapath: script(my_script).my_function
format: address, args
is referencing the text object called 'my_script' with the function called 'my_function', passing on the address and the arguments array.
This is the legacy way and should only be used if the above solution doesn't get you to the desired result.
where:
datapath: bpy.data.texts['my_script'].as_module().my_function('{0}',{1})
format: address, args
is referencing the text object called 'my_script' with the function called 'my_function', passing on the address and the arguments array.
- You need to enable Format and pass on a variable to the custom function.
- You cannot use Loop.
- You cannot send messages this way.