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.