BGE | run script on startup
I use the next setup.

launcher.blend has a camera and a plane with a python controller that run my script launcher.py and the logic is always sensor &gt; python controller &gt; game actuator:



And the script check for files and...

from os.path import isfile, join
from scripts.settings import Settings
from scripts.functions import erro, install_path

class Launcher():
    """This class launch the game if no problem encountered."""
    def __init__(self, controller):
        """Assing game actuator file name and mode"""
        self.settings = Settings()
        self.gameActuator = controller.actuators['Game']
        if isfile(join(install_path, 'intro.blend')):
            self.gameActuator.fileName = str(join(install_path, 'intro.blend'))
            self.gameActuator.mode = 0
            self.main = self.initialize
        elif isfile(join(install_path, 'menu.blend')):
            erro(self, 'intro.blend file not found', 1)     
            self.gameActuator.fileName = str((join(install_path, 'main_menu.blend') if isfile(join(install_path(), 'main_menu.blend')) else join(install_path(), 'erro.blend') )) 
            self.gameActuator.mode = 0
            self.main = self.initialize
        else:
            erro(cls = self, msg = 'menu.blend file not found', level = 0)

    def initialize(self, controller):
        """Launch the game menu if settings are ok."""
        if self.settings.read_config_file():
            print('ready...')
            controller.activate(self.gameActuator)
            # at this point, bge should restart and load the new blend.
        else:
            self.settings.defaults_settings()
            if self.settings.read_config_file():
                print('ready...')
                controller.activate(self.gameActuator)
            else:
                erro(cls = self, msg = 'menu.blend file not found', level = 1)
                try:
                    controller.activate(self.gameActuator)
                except Exception as e:
                    erro(self, 'Error fatal!', 0)


def main(controller):
    if not "launcher" in controller.owner.getPropertyNames():
        controller.owner["launcher"] = Launcher(controller)
        return
    controller.owner["launcher"].main(controller)