Create global function
I have a function within a model. How do I export that to be a function usable in other models? I have the function within an exisitng modl. I put it in a module and set the model's class to Filed module. Now what?
Thanks for reaching out and sharing your question. Here is a note from our developers:
You did exactly the right thing -- i.e., you placed the function in a module and then changed it to be a Filed Module. Because it contains a function, "Filed Library" would match the intent a bit better, but a Filed Module works fine.So what you now need to do is this... In your other model, where you want to use the function, select "Add Module..." on the File menu while in Edit mode, and click on the Filed Module file. It'll ask whether you want to link or embed. You'll probably want to link. The function will now be available.Note: You can use "Add Module..." or "Add Library..." to do this. They are functionally identical, the only difference being that the folder that the file selector dialog opens to initially.
Thanks. The new function I had created was part of an existing model. I needed to save-as to the name of the intended function (new_function.ana) and then delete all elements of the model except the filed module with the function. Then I could do as you suggested to use the new function in other models. Works like a charm.
Awesome - glad it worked for you!
Glad you got it to work.
Your original posting said that you "put it in a module and set the model's class to Filed module." You should have changed the module's class to Filed module (not the top-level model's class). It will ask you for a file name for the filed module. That will save you next time from the step of having to "delete all elements of the model except the filed module with the function."