You can either use extensions for this. Or instead of op(), use mod(), which will return the module of that Text DAT. That’ll allow you to call functions as you typed.
Extensions are the most organized and “touch-like” way to add Python functionality. Accessing them using ext.ExtensionName searches upwards through the network hierarchy, so you can build Python functionality at the top level of your project by adding an extension to your highest component. Similarly, you can add Python functionality to individual custom components by adding extensions at that level.
Working directly in DATs can be a quick and dirty fix or testing technique, but for polished projects I highly recommend using extensions.