I have a script that creates a number of features "in_memory." Once I have them in memory I need my script to create a list of everything "in_memory" - I'm not sure how to achieve this. Is anyone knowledgeable on how to achieve this result?

Below is the portion of my code that creates my features in memory.

for fc in fcs:
    arcpy.Clip_analysis(fc, Buffer, "in_memory" + "\\" + fc)

1 Answer 1


Set your workspace to in_memory, and then list feature classes there:

import arcpy

arcpy.env.workspace = 'in_memory'

fcsInMemory = arcpy.ListFeatureClasses()

if you have tables in memory, and you want those too, add:

tblsInMemory = arcpy.ListTables()

If you want to guarantee that you're only grabbing the intended feature classes and that all of them are there, you could do this instead:

fcsOut = list()
for fc in fcs:
    fcOut = os.path.join('in_memory', fc)
    arcpy.Clip_analysis(fc, Buffer, fcOut)
  • Is there any way to do this without necessarily having to change the workspace? Something along the lines of arcpy.ListFeatureClasses(workspace_path)
    – user32882
    Aug 4, 2018 at 12:44
  • 2
    @user32882, One would think that ESRI would be considerate enough to allow the workspace as an argument, but--as usual--they avoided the most obvious and useful option. You could use Walk, but it requires four lines of code, so you might as well change the workspace and then change it back. That said, Walk does run much faster.
    – Tom
    Aug 6, 2018 at 14:39

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.