What potential pitfalls should be considered when including external files in PHP scripts that utilize sessions?

When including external files in PHP scripts that utilize sessions, a potential pitfall to consider is that the external file may inadvertently start a new session, potentially causing conflicts or unexpected behavior. To avoid this, it is important to check if a session has already been started before including the external file. This can be done by checking if the session_id is empty before calling session_start().

<?php
if (session_id() == '') {
    session_start();
}

// Include external file here
include 'external_file.php';