Autonomous Selector Always Returning Null

I’m starting to mess around with choreo, and I’m having a problem where my ChoreoRoutine class is always null for some reason in my Autos.kt class, so it crashes when I try to run autos

This is the ChoreoRoutine class
This is the Autos class

if anyone knows why please let me know ASAP

I’m not an expert in Kotlin, so please forgive me if I’m wrong, but It appears that you initialize all your subsystems and your Auto class inside RobotContainer, but you try to access and call a function from Auto inside Robot, which could lead to the null error you’re getting. Try creating a function inside RobotContainer that returns the auto command, that way you know for sure that all the necessary requirements have been initialized. Here’s an example from our code:

 public Command getAutonomousCommand() {
        Command command = autoChooser.get();
        if (!command.getName().equals("1Note-Vision")) {
            drive.resetOdometry(PathPlannerAuto.getStaringPoseFromAutoFile(command.getName()));
        }
        return command;
    }

Which is called in Robot:

public void autonomousInit() {
        autonomousCommand = robotContainer.getAutonomousCommand();
        
        // schedule the autonomous command (example)
        if (autonomousCommand != null) {
            autonomousCommand.schedule();
        }
    }

Hope this helps! Feel free to follow up with any questions etc.