Override a view definition programmatically
Ok, I got to a working solution : 

$my_view_name = 'my_test_view';

$view = views_get_view($my_view_name);
if ( $view ) {
  views_delete_view($view);
}

// ... code from view export UI ... 

$view-&gt;save();


If the view exists already then I delete it before recreating it.   

Then I throw in the code taken from the views export UI, and add right after a $view-&gt;save();

And that does it.