This example snippet assumes you're importing variations with a "color" attribute. You will need to adjust it if that's not the case for your products.
function wpai_image_imported( $post_id, $att_id, $filepath, $is_keep_existing_images = '' ) {
$product = wc_get_product( $post_id );
if ( ! $product ) return;
$parent_id = $product->get_parent_id();
if ( empty( $parent_id ) ) return;
$parent = wc_get_product( $parent_id );
if ( ! $parent ) return;