Error when getting access to classes with BabylonJS and Colyseus

Yes ! In order the avoid any duplication from the server, I would like to call existing methods from the client which do the exact same logic.

To give a short example, I have a method in my class Player on the client side which allow my player to move at a specific position. At the moment, I have the exact same method in my class Player on the server. Since both methods are using the exact same logic, is there a way to re-use that exact same method while knowing if this method is called via the client or the server?

For smaller games, it is “ok” to duplicate the game logic. However, the bigger the game, the bigger the amount of systems. I would like to re-use game logic on both client and server in order to avoid any repetition.