Background: Since Teststand's TSM does not support python, I hope to use TSM's multi test step to implement SMU voltage/current measurement and generate reports using the built-in report plugin(csv test results log).
Current situation: I used "Getting Started with Semiconductor Module.seq" as a template and modified the test step. The test part of the code in multi test vi was changed to call the node of python to implement voltage/current measurement, that is, only the measurement part of the code is implemented in python, and the rest is still implemented in LabVIEW.
Problems encountered: When the Teststand program is running, an error will be reported in the python call, and the session conflict. The python code has no problem measuring voltage/current and can run independently.
 
 
import nidcpower
def configure_and_measure(resource_name, voltage,current):
    session = nidcpower.Session(resource_name=f"{resource_name}", options={})
    session.source_mode = nidcpower.SourceMode.SINGLE_POINT
    
        
    session.channels[0].output_function = nidcpower.OutputFunction.DC_VOLTAGE
    session.channels[0].voltage_level = voltage
    session.channels[0].current_limit_range = 10e-3
    session.channels[0].current_limit = 10e-3
    session.commit()
    
    
    session.wait_for_event(event_id=nidcpower.Event.SOURCE_COMPLETE, timeout=5)
    measurements = session.measure_multiple()
    
    
    return measurements[0][0]