I am trying to test the ability to change the impedance on a TravelMode using python:
travelModes = arcpy.nax.GetTravelModes(NDLayerName)
travelMode = travelModes["Travel Mode OnRoad"]
travelMode.impedance = "Shortest"
arcpy.AddMessage("impedance = " + str(travelMode.impedance))
However, either I am doing something wrong or else maybe there is a problem in Pro 2.5 with changing the impedance using python or a problem with the impedance being held in memory? I've tried numerous times to change the impedance without the route using the changed impedance, and then it worked. Then when I tried to change the impedance to something else - "OnRoad', now it is stuck on "Shortest". I tried saving the project, closing Pro, reopening Pro and the project, then running the solve again, but with the impedance set to "OnRoad", the route being created is for the Shortest. The TravelMode actually has "OnRoad" as the impedance, so I tried deleting the line setting
travelMode.impedance = "OnRoad" (since without that, the actual TravelMode setting should be used, and the route created is still using the 'shortest' instead of OnRoad. Any ideas what is wrong? Or is this a bug in 2.5? Thanks!