First, add NationalInstruments.TestStand.Interop.API to your project (right-click References >> Add Reference >> Assemblies >> Extensions >> NationalInstruments.TestStand.Interop.API).
Then add using NationalInstruments.TestStand.Interop.API to your source file.
After that; you need to add the TestStand sequence context as an argument to your method. From there, you can access all of the TestStand variables from the sequence context and modify them using the set methods. There are several different set methods available depending on the datatype of the variable you want to modify. Since this is already at the intended variable scope, the lookup string argument will just be the name of the variable. Here, I'm setting a StationGlobal named "test" that is a numeric datatype:
Then, from TestStand, pass "ThisContext" into the sequence context argument:
Thank you very much for your reply, under your guidance, this problem has been solved！
I also tried to modify the file type of "StationGlobals.ini" to XML, and directly edit this XML file to achieve the effect I need.