I am looking for the most efficient way to save data from one run of a python script to the next. My script generates a list , say presentList . The list is made up of a number of integers. Next time the script runs I want to use that list again as previousList. I would prefer that this data be written and read from memory rather than disk since my script runs quite often and I don't want to write so often to my disk. Can I use pickle with BytesIO to accomplish this? I am also using Animation Nodes. Perhaps there is a way to send the list to and from Animation Nodes to make the data persistent? Thanks for any advice on this. Perhaps this would be better asked on a python forum.

  • $\begingroup$ This question seems to get pretty close to yours: blender.stackexchange.com/questions/103233/… $\endgroup$
    – WhatAMesh
    Feb 26, 2019 at 9:24
  • $\begingroup$ @brockmann the data is just a list of integers. $\endgroup$
    – Jim Ruxton
    Feb 26, 2019 at 9:27
  • 3
    $\begingroup$ Possible duplicate of How to store particle locations in a list? $\endgroup$
    – Omar Emara
    Feb 26, 2019 at 11:45
  • $\begingroup$ Cant you just use a custom attribute? should be memory based. Can be made on a collection or something $\endgroup$
    – Jackdaw
    Feb 26, 2019 at 12:56
  • $\begingroup$ Thanks @OmarAhmad Tthis may work. I was hoping for an all python solution but if I can do it in animation nondes that would be great too. $\endgroup$
    – Jim Ruxton
    Mar 1, 2019 at 8:13

1 Answer 1


Based on the comment Omar posted I found that I could simply use the python statements setattr() to save my list and getattr() to retrieve it. In this case I stored the list as an attribute in animation_nodes as shown in Omar's example however I assume I could have stored it in any object in my scene. This allowed me to have data persist between running instances of my python script,


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .