I am working on a game right now but I really hate having a few thousand lines to scroll through when finding a bug to fix or a new feature has stuffed up another function. I have kept everything in one main class and when I looked into writing each function into a different file, I had one problem, I couldn't find anything
def __init__( self ):
self.foo = "Foo"
def function( self, bar ):
self.bar = bar
I was wrong in my comment, you can do as you describe, but as @Ignacio stated its not good code design. Here's an example anyway because I was curious:
#Empty my_game 'class' class my_game: pass #Function you can put in a different file and import here #Will become set as the new init function to 'my_game' def my_games_init(self,x,y): self.x = x self.y = y #Assigning 'my_games_init' function to be used as init of 'my_game' class my_game.__init__ = my_games_init #Make a 'my_game' instance and show that it's x and y methods were set g = my_game(1,2) print g.x print g.y