Editing python script in external text editor

I want to use other text editors to edit python script outside touch designer. However, it seems the text editor cannot recognize operations such as ‘op’. Do I need to import some module in order to get rid of the error message (the error message says undefined variable ‘op’)? Or is there a way to get rid of this error message?

Not sure how you managed to encounter that error, but in TD preferences, under DATs, you can set the external editor application to use for Text & Table DATs.
Does that solve your problem?

It sounds like you are using an IDE editor as opposed to a text editor (ie something like Idle or Atom as opposed to something like Sublime Text).
Basically, a tool for building a project (managing multiple files & packages, error detection, debugging etc) and not just editing text.

I’m not sure if there are any packages that you can import to set up an editing environment that will match TD’s python runtime environment.
Its very tightly coupled to TD

I use Sublime Text, and only rely on Syntax Highlighting, as opposed to any debugging/intellisense/IDE tooling.

Thanks for helping me!
My issue is more like something @towerful talks about. I want to use an external text editor instead of using the integrated editor since I can have my code lint and code hint there. My issue is that I don’t know whether there is a way to import library that TD uses so that my text editor won’t yell at me about using op classes. I guess there is no way of doing so. I feel like all of those TD classes such as op class are integrated in TD and my text editor isn’t smart enough to tell this.

Thanks for your helping!
I actually use vs code. It is my plugin for python that doesn’t like op class. But I have to depend on that plugin for code hint, code completion. So I guess it’s a non-issue for the usage of op class outside TD.

unfortunately at the current time the TouchDesigner specific classes cannot be hooked into an IDE.