'op' not defined in visual studio code

I’m trying to follow Lake Heckaman’s Real Time Weather API in TouchDesigner tutorial and I think I’m having trouble properly integrating my visual studio code app with TouchDesigner because the line:
op(‘request_output’).text = json.dumps(data)
is returning the error message:
NameError: name ‘op’ is not defined
jillianvordick@Jillians-MacBook-Pro-4 ~ %

I’ve already changed my preference in TD and I’ve also selected my python interpreter in VSC. My path interpreter is set to /Applications/TouchDesigner.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3.11, as per the textport in TD.

However, the Experimental:TDI Library guide says that after doing so, you should be able to open a parameter execute DAT and type “me” and have all of those options show up. When I type “me” I just get memoryview, memoryerror, and modulenotfounderror. Does this mean that my VSC is not actually communicating with TD?

Afaik the TDI Library is not yet released in any public TD version

how is it working in Lake’s tutorial then? He doesn’t show how he got VScode to work with TouchDesigner so I don’t know what I’m doing wrong. He uses ‘op’ and it works just fine.

Probably like this TD Stubs in VSCode?

This (and TDI) will help you while writing code . To actually run the scripts you have to run them in TD (not in VS code)

hmm ok. In his video tutorial he only writes/runs the code in VScode and it appears inside of his text DAT when he uses ‘op.’ I’ll take a look at that forum though. Thanks.

I quickly looked at the video. He writes the code in VSC and when saving the file, it shows up in the text DAT. You usually do this by enabling “sync to file” in the text DAT.

VSC will warn about stuff like op() as it does not know about that TD specific function. If you integrate the stubs mentioned above, VSC knows the functions and attributes TD offers, and the warnings will disappear. But it’s just for convenience and not really necessary

As VSC can’t access TD, you need to run the code inside TD. Select your text DAT in TD and use the ctrl-r hotkey.