I am creating a new layer out of an old one with MakeFeatureLayer_management like this:

arcpy.MakeFeatureLayer_management("layername", "newlayername", "DEPTH = 1200")

This works for the first time but if I want to execute the function on the same layer again (with a new out_layer and a different where clause) like this:

arcpy.MakeFeatureLayer_management("layername", "secondlayername", "DEPTH = 1400")

I get

Runtime error Traceback (most recent call last):
File "", line 1, in
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5774, in MakeFeatureLayer
raise e ExecuteError: ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_features.

Also the auto completion for in_features no longer shows the used layer.

What can I do to fix this?

1 Answer 1


Based on the edits to your original question, try something like this:

import arcpy

input = "featureclass or shapefile"

arcpy.MakeFeatureLayer_management(input, "newlayer", "query")
arcpy.MakeFeatureLayer_management(input, "newlayer2", "query")

Make the input to the MakeFeatureLayer management tool the dataset rather than a layer created from the dataset.

  • I'm sorry I seem to have not phrased my question good enough: I want to create multiple new layers out of the original layer. Each layer will only have one where clause though. The problem is that for the second execution (with a different where clause but the same input layer) the input layer is no longer accesible
    – k-nut
    Commented Dec 12, 2014 at 14:05
  • I edited the question to hopefully make this a little clearer
    – k-nut
    Commented Dec 12, 2014 at 14:07
  • making the input a featureclass instead of a layer created from the dataset seems to have solved the problem. Thank you!
    – k-nut
    Commented Dec 16, 2014 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.