Using variables as objects in python
I am attempting to write a script that connects to various databases in MongoDB via pymongo, 
however ive come to a little stumbling block:

I have a list of collection names in an array which i would like to store and access in a dictionary later on in the running of the script, 

so i have 

    class RA():

        class Meta:

            connection_dict = {}
        
            connection_array = [a,b,c,d,e,f,g,h]

        def __init__(self):
            
            self.open_connections()

        def open_connections(self):
            
            import pymongo
            
            connection = pymongo.Connection('localhost')

            db_connection = connection.db_namae

            for con_id in self.Meta.connection_array:
                self.Meta.connection_dict.update({con_id : db_connection.con_id})

as it stands this just creates a dict of n entries all connected to db_connection.con_id:

So the question is how do i use variables in that final line to create different connections rather then just connect to the db_connection.con_id? As beforehand i may not be able to hardcode these connections in, due to their being too many or an increment in number of them in the future
Using variables as objects in python
===

I am attempting to write a script that connects to various databases in MongoDB via pymongo, 
however ive come to a little stumbling block:

I have a list of collection names in an array which i would like to store and access in a dictionary later on in the running of the script, 

so i have 

    class RA():

        class Meta:

            connection_dict = {}
        
            connection_array = [a,b,c,d,e,f,g,h]

        def __init__(self):
            
            self.open_connections()

        def open_connections(self):
            
            import pymongo
            
            connection = pymongo.Connection('localhost')

            db_connection = connection.db_namae

            for con_id in self.Meta.connection_array:
                self.Meta.connection_dict.update({con_id : db_connection.con_id})

as it stands this just creates a dict of n entries all connected to db_connection.con_id:

So the question is how do i use variables in that final line to create different connections rather then just connect to the db_connection.con_id? As beforehand i may not be able to hardcode these connections in, due to their being too many or an increment in number of them in the future