Setting material node properties across a large number of objects? I'm using a Python script to generate a star-field using data from ~9k of the brightest stars (data is taken from here) Spheres are generated equidistant from the camera (eventually these will be filled circle billboards), and I'm hoping to adjust their magnitudes using an emission shader. 

Is there a way to adjust the emission strength of each individual sphere without creating 9000+ separate textures?

My first run at the code was able to change the emission strength of the material, but it's changing it for all of the spheres each time. The code is below:

...
# Load star data from file
starData = np.loadtxt('/stars/catalog_text')
distanceMultiplier = 1000 * 5

# Create base stare
star1 = Star(starData[0])
starMesh = star1.getMesh()

# Duplicate mesh for every star in the data
i = 0
for star in starData:
    i += 1

    # Set Location variables from data
    magnitude = star[2]
    x = star[3] * distanceMultiplier
    y = star[4] * distanceMultiplier
    z = star[5] * distanceMultiplier

    # Set star magnitude from data
    # (convertMagnitude maps the magnitude value to an emission strength value in Blender) 
    emission = bpy.context.active_object.active_material.node_tree.nodes.get("Emission")
emission.inputs[1].default_value = convertMagnitude(magnitude)

    # Create a copy of our base star
    newOb = starMesh.copy()

    # Assign unique name and location to mesh
    newOb.name = "star_" + str(i)
    newOb.location = (x, y, z)

    # Link mesh to the scene
    bpy.context.scene.objects.link(newOb)
bpy.context.scene.update()
There currently appears to be no way to have one material with different settings for each object using it. While an object knows what materials it uses, a material has no link back to the object using it, as a single material may be used by many objects there is also the trouble of choosing which object is currently active.

I see two ways to tackle your problem, one material for each object or a range of materials to be shared across objects. I think a range of materials with varying emission strengths could be generated and one chosen as each object is created. I'm not sure of the range of values in your data, but expect that emission values could be averaged out a bit so that magnitudes within a range could use the same material.

if magnitude &gt;= 100 and magnitude &lt; 200
    obj.material_slots[0] = bpy.data.materials['mag150']