Solution
When you work with NI‑VISA, each time you open a resource (such as a serial port) VISA creates a session inside the memory space of your process. This session is represented by a handle that is only meaningful to the process that created it. VISA uses that handle to access internal state, buffers, and communication settings that exist exclusively within your process. Because of this architecture, you cannot share a VISA session with another process, nor can another process reuse the same session handle.
For example, if you open a VI in LabVIEW that opens a session to the port COM1 using NI-VISA, you will be able to use it in TestStand, as long as the LabVIEW adapter is set to use the same LabVIEW Development Environment that is running the VI. This happens because TestStand is not the process allocating the resource, but instead, it calls the LabVIEW Development Environment to operate on the serial port.

However, if you then try to open, configure, or communicate with the same port from a different process, VISA cannot establish a new session to that resource. For example, if you have the VISA Test Panel open from NI-MAX and try to run the same sequence, you will receive error –1073807246 (0xBFFF0072)indicating that the resource is valid, but VISA cannot access it because another process currently owns it. Closing the VISA Test Panel or using another COM port (e.g., COM 2) would eliminate the error.

The same thing will happen if you create an executable from the VI used above. That executable runs as an independent process; thus, you’ll get the error when running your test sequence. If your goal is to run the TestStand Sequence, make sure you close the executable before running the sequence.

Lastly, another case that can generate this error is if you try to share a VISA session reference between test steps with different adapters (LabVIEW, LabWindows™/CVI™, Python, etc.). You cannot share a VISA session across processes, and for serial ports specifically, you also cannot have two different processes open the same port at the same time. For example, if LabVIEW has opened COM1, a Python step cannot perform a serial read on COM1 until LabVIEW releases it.