You appear to have a scope problem. The variable you're trying to access, neighbours_identification, was declared in an if block and is thus only visible within that if block. If you need to handle it outside of the if block, you must declare it outside of (before) the block.