Check this thread: http://salilab.org/archives/modeller_usage/2009/msg00281.html

It means that you have to define your MyModel class OUTSIDE the main script and then import it.

Just open a new script, call it MyModel.py, paste the class MyModel inside. Don't forget to add the necessary imports at the top. Then in your main modelling script just add "from MyModel import MyModel" in the beginning. That should do the trick.

Regards,

João [...] Rodrigues
@ http://stanford.edu/~joaor/