Load a cache file in Maya using Python and create the same render output
Question: I try to load a cache file in Maya using a python script. I used the code
snipped posted here: [importing multiple cache files in Maya using
Python](http://stackoverflow.com/questions/20174424/importing-multiple-cache-
files-in-maya-using-python?answertab=active#tab-top)

My code looks like this:

    
    
    pm.mel.doImportCacheFile(myCachePath, "", [selectedObject], list())
    

`myCachePath`: Stores the path to the xml file `selectedObject`: e.g.
`flameShepe1` (represents the fluid container)

First I thought that it finally worked, but whenever I press the play button
and render an image again I don't get the same output. The simulation has the
same shape but the colors are not the same.

When I use `Fluid nCache -> Attache Existing` ... everything works.

How is that possible?


Answer: Reading the attach cache command, Attaching cache to fluid is different, try :

    
    
    pm.mel.doImportFluidCacheFile(pathCache, "xmlcache", ['fluid1'], [])
    

Hope it will do the trick !

\---EDIT---

Note that you could do without pymel formating a string like this :

    
    
    lineToEval = 'doImportFluidCacheFile("{0}", "xmlcache", {{"{1}"}}, {{}});'.format( pathCache, fluidsSel[0])
    mel.eval(lineToEval)
    

