Fetching a function from another creator app

Fetching a function from another creator app

Hi,

I have two apps in creator.

App A has two fields; 'Product code' & 'Product name'. App B also has two fields; 'Product no' & 'Name'.
The 'Product code' field in App A is lookup field which looks at 'Product no' in App B.

When filling in App A, I would like the 'Product name' field to auto populate based on the selection of the other field. I know I have to create a function in App B and then a script in App A to call in said function. i have found a lot of contradictory articles on line so am confused. This is the deluge scripts I have put together.

FUNCTION (App B)

string LookProduct(int Product_no)
{
Product = New_product[ID == Product_no].Name;
return Product;
}


FORM WORKFLOW (APP A)

input.Product_name = AppB.LookProduct(input.Product_code);


I'm not sure where I'm going wrong; can anyone offer a correction to my script?