Spot on Maria!!
It's because of this - see comment #2 - https://bugs.totaralms.com/show_bug.cgi?id=12749#c2
I had put the require_once at the top of the file /totara/program/program.class.php
I've moved the require_once inside the function display_current_status() and the add courses popup now works
// Notify if there are courses in this program which don't have audience visibility to all.
if (!empty($CFG->audiencevisibility)) {
require_once($CFG->dirroot . '/totara/cohort/lib.php'); // VISION - needed for constants.
$coursesnovisible = $this->content->get_visibility_coursesets(TOTARA_SEARCH_OP_NOT_EQUAL, COHORT_VISIBLE_ALL);