The question of which option one should use is an opened question! In fact, it highly depends on your own preferences: some people do not want to hear of code generators, others keep metaclasses away from their code. Some argue that it is best to maintain the model only, deriving the necessary modules at runtime, while others prefer to statically generate the code so that it can be put under version control, for example, or because they want to keep an eye on the generated parts.
This being said, here are a few comments:
mdl_generate_python_code.py(or a similar approach if you build the code by your own means).
Now if you're really looking for an advice, let's say that our personal preference consists in dynamically building the modules, using metaclass and properties.
Comments are welcome: Sebastien Bigaret / Modeling Home Page