To register a Python function that is callable from other TypeScript or Python functions, you must give your Python function an API name. To do this, provide the api_name field in the @function decorator:
Copied!
1from functions.api import function
23@function(api_name="myPythonFunction")4defmy_python_function()->str:5return"Hello World!"
Call a query function
After publishing your TypeScript or Python query function, navigate to the code repository where you want to consume the function, and import it using the Resource imports sidebar.
Then, your function will be callable from the consuming repository. For example, to call it from a Python function:
Copied!
1from functions.api import function
2from ontology_sdk import FoundryClient
34@function5defcall_query_function()->str:6return FoundryClient().ontology.queries.my_python_function()
Calling a TypeScript query function from a Python function will look exactly the same; publish the TypeScript query function with an API name, then consume it from Python as shown above.