This question has already been asked for blender 2.8, now that I have had an answer I quote the code fragment of @aliasguru's answer
(How to write __annotations__ (scene property) in new scene?)
This works perfectly on blender 2.8, now I'm trying to figure out how to make it work on blender 2.79, but I can't find the right keys to do it. It is simply a matter of copying the props "props" of the scene recorded in a class of PropertyGroup
def my_function(self, context):
first_scene = bpy.context.scene
### new scene creation comes before the loop:
new_scene= bpy.data.scenes.new("New scene")
context.window.scene = new_scene
### copy attributes from source to target scene:
for key in first_scene.scene_prop.__annotations__.keys():
source_attribute = getattr(first_scene.scene_prop, key)
setattr(new_scene.scene_prop, key, source_attribute)
the error I get during code execution is:
AttributeError: 'MyclassPropertyGroup' object has no attribute '__annotations__'
Note: Within the class there are properties of type enum, float, int, string, bool