I know this might sound strange but is it possible to redefine an entity's function or action at runtime?

I currently have a basic workaround that creates a new entity using ent_create, with the new function name, and then i get the properties of the existing entity (x,y,z,pan,roll etc), and set them to the new entity.

This sort of works, but it takes time and i don't know if i can set all properties, like flags etc.