Currently, using pygame.joystick.init() only works if the controller is on before running the script. I'd like to be able to turn the game on and then turn on the controller while it is running to switch easily between keyboard and joystick.
Some reading indicates that pygame 1.# does not seem to be able to deal with joysticks being added or removed while running. That is because pygame is based on SDL, and before version 2, SDL does not handle joysticks being added or removed while running.
SDL vesion 2 apparently does and pygame version 2 is based on SDL 2. You could try upgrading to pygame version 2 and see if that helps.
How to detect controllers while the game is running in PyGame