Making a data block single user through python

Hi

Short version: I need to press this button:
301 times (through script hopefully).

Long version: I’ve got 301 text curves generated by particles, and I need to change their texts randomly through a script I wrote. The problem is that all the text objects use a single text datablock, so they all get the string designed for the last text object.

I would like to press the “301” button every time before setting the text. Is there any way to do that through python? I will have to use this script on this amount of text many times in the project, so I would do anything to not have to do this manually.

Thanks

Shef

This code is equivalent to that button:

ob = bpy.context.object
ob.data = ob.data.copy()

Thank you so much! :smiley: