This is a very interesting topic! I'm trying to picture myself splitting up a generic and quite large python script. It almost requires you to rewrite it from scratch, I would say, although with a lot of copy-pasting from the old script of course.
I wouldn't say I'm an expert in how to layout your code, but ;) I've designed a some 10,000-rows of code application in a way basically a series of classes are inheriting each other. I've also grouped the classes into separate files. Example: So,* myApp.py* is my main application. It imports the configuration *appConfig.py* and makes the class "Launcher" in myApp inherit the configuration. Then *appBrowser.py* and *appToolbox.py* are modules which in turn import and inherit a shared library called *appCommon.py*. For example, using this setup all database queries can be performed through the DBQuery class in appCommon only, so this is the only file which needs to import the psycopg2 package to access the db. Since appCommon.DBQuery is talking to the database, it also needs stuff from the appConfig.py which it therefore inherits. In *appCommon.py*, I'm daisy chaining classes so that one final class has access to all classes' methods. In case you don't want to do this you can just create classes which inherit the class methods you are interested to pass on further to a module. Does it make sense? I would be very happy to get any kind of feedback on this kind of layout. It's just something I've come up with and based a large application on without really having anyone to bounce ideas off. I'm sure there are lots of cons with this setup, but for me/us it works quite well so far. // Fredrik -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWPX4m_pmZ8Tm24YOHJ24LebzS3vwW8aYqfXq3%3Djm-EZbA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
