I am creating a Python script to work with ArcGIS Pro. When I used the AddLocations and Solve functions in the NA module continuously, I found that only the former function worked and the latter function ran with an ERROR (ERROR 000840: this value is not a network analysis layer). The same thing happens when I change the order of AddLocations and Solve.
In the image above, the Solve function works, but the AddLocations function fails.
In addition, I found that this code runs correctly in Pro's native Python window, but fails when it is made into a geoprocessing tool.
Can any master please tell me why?
I've found out why.
When the second function passes in the network analysis layer "路径", the program recognizes a sublayer of the network analysis layer that is also named "路径".