Error function query

You have to pass in the $query variable to use it in your function; if you don’t, PHP uses null.

Try:

function elc_cursos_en_el_blog( $query ) {
 
 if ( $query->is_home() && $query->is_main_query() ) {
  $query->set( 'post_type', array( 'post', 'CursoTL' ));
 }

}
add_action( 'pre_get_posts', 'elc_cursos_en_el_blog' );

See pre_get_posts for the hook’s documentation.