The `InputManager` will raise a `DeviceOpenException` when a Controller is already opened. This can occur when an `InputManager` is instantiated twice. A game could have a main-menu screen which has multiple game views each with it's own specific `InputManager`. Users may venture into one game view, and then into another, which would instantiate multiple `InputManagers`. We probably should not have to bind/rebind controllers between these switches, instead, `InputManager` should just check if the device is open before attempting to open it. The following game contains a minimal example of this. It has a Main Menu Screen, and a Game View. After showing the game view, going to the main menu and back into the game view, the error occurs (if a controller is connected). To recreate the error in the example below, do the following: 1. Start the game 2. Ensure your controller is connected 3. Hit Play 4. Press Escape/Start 5. Press Play again -> `DeviceOpenException` occurs ```Python import pyglet import arcade from arcade.future.input import ActionState, InputManager, Keys, ControllerAxes, ControllerButtons import arcade.gui import arcade.gui.widgets import arcade.gui.widgets.buttons import arcade.gui.widgets.layout WIDTH = 800 HEIGHT = 800 class Player(arcade.Sprite): def __init__(self, sprite_file, controller): super().__init__(sprite_file) self.input_manager = InputManager(controller=controller, action_handlers=self.on_action) self.input_manager.new_action("pause") self.input_manager.add_action_input("pause", Keys.ESCAPE) self.input_manager.add_action_input("pause", ControllerButtons.START) self.input_manager.new_axis("move_horz") self.input_manager.add_axis_input("move_horz", Keys.LEFT, scale=-1.0) self.input_manager.add_axis_input("move_horz", Keys.RIGHT, scale=1.0) self.input_manager.add_axis_input("move_horz", ControllerAxes.LEFT_STICK_X, scale=1.0) self.physics_engine = arcade.PhysicsEngineSimple(self) def on_action(self, action: str, state: ActionState): if action == 'pause' and state == ActionState.PRESSED: main_menu = MainMenu() window.show_view(main_menu) def update(self, delta_time: float = 1/60) -> None: self.input_manager.update() self.center_x += self.input_manager.axis("move_horz") * 20 * delta_time class Game(arcade.View): def __init__(self): super().__init__() self.player_list = None self.controller_manager = pyglet.input.ControllerManager() def setup(self): self.player_list = arcade.SpriteList() self.player = Player( ":resources:images/animated_characters/female_person/femalePerson_idle.png", controller=self.controller_manager.get_controllers()[0] ) self.player.position = (WIDTH / 2, HEIGHT / 2) self.player_list.append(self.player) def on_draw(self): self.clear() self.player_list.draw() def on_update(self, delta_time): self.player_list.update(delta_time) class PlayButton(arcade.gui.widgets.buttons.UIFlatButton): def __init__(self, text="Play", width=200): super().__init__(text=text, width=width) def on_click(self, event): window = arcade.get_window() game = Game() game.setup() window.show_view(game) class MainMenu(arcade.View): def __init__(self): super().__init__() self.background_color = arcade.color.AMAZON self.ui = arcade.gui.UIManager() self.v_box = arcade.gui.widgets.layout.UIBoxLayout(space_between=20) play_button = PlayButton() self.v_box.add(play_button) ui_anchor_layout = arcade.gui.widgets.layout.UIAnchorLayout() ui_anchor_layout.add(child=self.v_box, anchor_x="center_x", anchor_y="center_y") self.ui.add(ui_anchor_layout) def on_show_view(self) -> None: self.ui.enable() def on_hide_view(self): self.ui.disable() def on_draw(self): self.clear() self.ui.draw() window = arcade.Window(HEIGHT, WIDTH, "Input Manager Controller Error") window.show_view(MainMenu()) arcade.run() ``` Traceback: ```python File "E:\Programs\python-arcade\MiCurry-Examples\InputManager-Bug\input_manager_bug.py", line 85, in on_click game.setup() File "E:\Programs\python-arcade\MiCurry-Examples\InputManager-Bug\input_manager_bug.py", line 58, in setup self.player = Player( ^^^^^^^ File "E:\Programs\python-arcade\MiCurry-Examples\InputManager-Bug\input_manager_bug.py", line 16, in __init__ self.input_manager = InputManager(controller=controller, action_handlers=self.on_action) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Programs\python-arcade\arcade\future\input\manager.py", line 117, in __init__ self.controller.open() File "E:\Programs\python-arcade\venv\Lib\site-packages\pyglet\input\base.py", line 749, in open self.device.open(window, exclusive) File "E:\Programs\python-arcade\venv\Lib\site-packages\pyglet\input\base.py", line 87, in open raise DeviceOpenException('Device is already open.') pyglet.input.base.DeviceOpenException: Device is already open. ```