# Switch between multiple lists stored in scene

I recently started to learn Python and I started to develop a selection pie, which the user can quickly select objects and quickly switch between selection sets, like working with multiple character rigs and each rig has it's own selection set.

I'm trying to figure out what is the simplest way to switch between multiple lists, that can be stored in scene? I haven't figured out how to append objects to a ID property list, so I'm using a regular list, that the stored scene lists refer to and vice versa. But my functions refer to that temp list('curList'), which isn't stored in the scene.

So my problem is how I can have a function "know" what list it needs to stored and disconnect from the('curList'), before it switches to another list? I thought about saving all lists before making the switch, but I get an error that 'object can't be iterated' or something like that. But as an noob, I haven't figured out a way around that issue? :)

Here is a very simple example of what I'm trying to have functions do automatically.

import bpy

ctx = bpy.context
scn = ctx.scene
scn['list_a'] = ['']
scn['list_b'] = ['']
curList = []

curList = scn['list_a']       # tempList connects to sceneList
curList.append('Cube')

scn['list_a'] = curList       # current sceneList gets updates from temp
scn['list_a'] = scn['list_a'] # current sceneList disconnects from temp

curList = scn['list_b']       # tempList switches to another sceneList
# etc.


Any suggestions or tips are hugely appreciated! :)

This is my current solution that seems to work? But I'm sure there is a much better way out there!? :)

def list_obj_append(Id):
global curList
obj_selected = [o for o in bpy.data.objects if o.select]

curList = scn["set_1"]
scn["set_1"] = curList

for ob in obj_selected:
curList.append(ob.name + suffix[Id])

scn["set_1"] = curList
curList = scn["set_1"]

return curList