Referencing a function in another DAT

Can a Python function live in a DAT and be called from another script/DAT ? I wish to use a text.DAT as a container for a global function. Or is there a better way to make a global function ?

My preferred way is to place text DATs into /project1/local/modules/ and then if, for example, there’s a text DAT in there called foo and inside is a function called bar, I can type

import foo
print(foo.bar())

…anywhere else in the project

I’m sure someone else can give you more thorough or robust advice though. Some additional reading: MOD Class - Derivative and Introduction to Python Tutorial - Derivative (the DATs as modules section)

I asked something similar a while ago here also: How do I access a variable from another DAT? some good pointers there

2 Likes