Inheritable models and scopes

this PR fixes the generators so that scopes and modules can inherit from other scopes and modules