Yes, it is possible, but you use casper.thenOpenAndEvaluate() which has the word then in it. It means that this function is asynchronous and it returns the casper object to enable a builder/promise pattern. So you cannot return anything from a function like this. Since it is asynchronous, it will be executed after the current step ends, which is after console.log(newCount);.
You would need to split the function, for example like this:
//check if more than 1 page and add report count if (reportPages > 1) { var newCount; this.thenOpen('reports2.html', function(count){ newCount = this.evaluate(function(count){ add = count + $('#table1 tbody').first().children('tr').length; console.log('new count inside: ' + add); return add; }, reportCount); console.log(newCount); }).thenOpen('reports3.html', function(count){ newCount += this.evaluate(function(count){ add = count + $('#table1 tbody').first().children('tr').length; console.log('new count inside: ' + add); return add; }, reportCount); console.log(newCount); }).then(function(){ console.log(newCount); }); } It seems like you want to loop over multiple pages. This is usually done recursively, because CasperJS is asynchronous and you don't know beforehand how many pages you need to open. I suggest you look at this question for some examples: CasperJS loop or iterate through multiple web pages?CasperJS loop or iterate through multiple web pages?