I have a script tool that repeatedly solves an OD Cost Matrix problem using the method:
arcpy.na.Solve(in_network_analysis_layer)
A month ago or so I was using ArcGIS 10.5 and the script would run fine either as a stand-alone script or as a script tool within ArcMap/ArcCatalog. I recently upgraded to ArcGIS 10.5.1 and the script will only run within ArcMap if I reference an OD Cost Matrix Layer within the map document. It will not run otherwise.
The error message I've been getting is that the layer I'm using as an input is not a network analyst layer. However, I have confirmed that it is indeed a NA layer by using the method isNetworkAnalystLayer. I have even used this property right above the line of code that solves the problem.
I think this is a bug. I have never really used this forums and ESRI support, but I was not able to find a way of reporting it as a bug.
Does anyone have any ideas?