Custom attribute type not displaying terms in edit product – WooCommerce

I just had that problem and resolved it alone since i could not find the answer online.
You just need to put that code inside an if. Only to run that code on attribute page.

if ($_GET['page']=='product_attributes') {
  add_filter( 'product_attributes_type_selector', function($array){
    $array['test'] = __( 'Test', 'awcs' );
  } );
}