@classmethod
    def copy_alembic_data(cls, source=None, target=None):
        selection = pm.ls(sl=1)
        if not source or not target:
            source = selection[0]
            target = selection[1]

        #
        # Move Alembic Data From Source To Target
        #
        #selection = pm.ls(sl=1)
        #
        #source = selection[0]
        #target = selection[1]

        source_nodes = source.listRelatives(
            ad=1,
            type=(pm.nt.Mesh, pm.nt.NurbsSurface)
        )
        target_nodes = target.listRelatives(
            ad=1,
            type=(pm.nt.Mesh, pm.nt.NurbsSurface)
        )

        source_node_names = []
        target_node_names = []

        for node in source_nodes:
            name = node.name().split(':')[-1].split('|')[-1]
            source_node_names.append(name)

        for node in target_nodes:
            name = node.name().split(':')[-1].split('|')[-1]
            target_node_names.append(name)

        lut = []

        for i, target_node in enumerate(target_nodes):
            target_node_name = target_node_names[i]
            try:
                index = source_node_names.index(target_node_name)
            except ValueError:
                pass
            else:
                lut.append((source_nodes[index], target_nodes[i]))

        for source_node, target_node in lut:
            if isinstance(source_node, pm.nt.Mesh):
                in_attr_name = 'inMesh'
                out_attr_name = 'outMesh'
            else:
                in_attr_name = 'create'
                out_attr_name = 'worldSpace'

            conns = source_node.attr(in_attr_name).inputs(p=1)
            if conns:
                for conn in conns:
                    if isinstance(conn.node(), pm.nt.AlembicNode):
                        conn >> target_node.attr(in_attr_name)
                        break
            else:
                # no connection
                # just connect the shape itself
                source_node.attr(out_attr_name) >> \
                    target_node.attr(in_attr_name)
Copies alembic data from source to target hierarchy
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/Animation.copy_alembic_data