Redefine print()

Is there a way in touchdesigner to redefine/override the print function?
Basically I want the print function to print the name of the op calling it in addition to whatever I tell it to print, without me having to type that in every time.
I would also accept a way to define a function globally across the project in a way that can be typed quickly (typing out op('project').ext.log("Whatever") is too long, for example)

debug( “Foobar” )

2 Likes

Cool! That solves the immediate problem.
I’m still kind of curious about the bigger picture though, if there’s a way to define a function on a global level / override a built-in function. Any knowledge there would also be appreciated.

There are ways using the sys
Modules or similar approaches, but in general it is not a good idea to change anything built in.