I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies. f = ['Select_1', 'Join_1', 'Buff_1'] for x in f: arcpy.Delete_management(x) **Error:** Runtime error Traceback (most recent call last): File "<string>", line 2, in <module> File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.