I am using a Python script to create a number of text objects in Blender, and would like to have them use the Typewriter script so that they appear to be typing themselves out as the animation progresses. Here is my script so far:

import bpy, random

words = ['MANY', 'WORDS']
font = bpy.data.fonts.load('(path to font)')
mat = bpy.data.materials.get("Blue") 

for n in range(len(words)):
    new_x = (random.random()*3.2)-1.6
    new_y = (random.random()*15)-10.5
    new_z = (random.random()*1.8)-0.9
    new_scale = (random.random()*0.125)+0.125
    new_time = round(random.random()*300)
    bpy.ops.object.text_add(location=(new_x, new_y, new_z), rotation=(1.5708, 0, 0))
    new_text = bpy.context.object
    new_text.scale = (new_scale, new_scale, new_scale)
    new_text.data.font = font
    new_text.data.align = 'CENTER'
    new_text.data.body = words[n-1]

To realise this, I would change the new_text.data.body to new_text.data.source_text and insert two keyframes for character_count - one at new_time with value 0, and one at new_time+60 with value of len(words[n-1]). However, when I run the following commands in the console:

>>> ob = bpy.context.object
>>> ob.keyframe_insert(data_path='character_count')

I get the following error:

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct.keyframe_insert() property "character_count" not found

This is the data path I get when right-clicking on the field and selected "Copy Data Path", so I am reasonably sure that I have the right name. Can anyone advise me how I might resolve this? Many thanks.


1 Answer 1


The character_count property is on the data part of the text object. The Font panel is the data part for a text object, just as it is the mesh for a mesh object, armature for an armature object etc.

With a text object selected and in the console.

>>> C.object.data.keyframe_insert("character_count")

You must log in to answer this question.

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