Q:

play2 calling controllers, models, views in submodule

Trying to split my project to few submodules.
I've created submodules:
/modules/common
/modules/shopping
Now I am trying convert name spaces to new one including new structure.
my controller:
package controllers.common;
public class Index extends Controller {}

my model:
package models.common;
@Entity
public class AppMode {}

my view:
@(AppModeForm: Form[models.common.AppMode], CurrentMode: Boolean)
 @helper.form(common.routes.CMS.appModeSubmit, 'id -> "form") {}

And I am getting errors all the time. F.e:
an error in view:
reference to common is ambiguous; it is imported twice in the same scope by import controllers._ and import models._

[error] /home/kd/Application/modules/common/app/views/CMS/AppModeView.scala.html:9: reference to common is ambiguous;
[error] it is imported twice in the same scope by
[error] import controllers._
[error] and import models._
[error]                     @helper.form(common.routes.CMS.appModeSubmit, 'id -> "form") {
[error]                                  ^
[error] one error found

A:

models and controllers are automagically imported into the play templates, so this causes the problem, you would either have to not name them the same, (for example turn the package structure around to common.{models, controllers} and then explicitly import what you want from there. Of course since there might be more than one thing called routes you would still have some problems with overloading (but you can workaround by renaming things you import for the current scope like this:
@import controllers.common.{routes => commonRoutes}

@helper.form(commonRoutes.CMS.appModeSubmit, 'id -> "form") 

An easier option would be to just explicitly specify the package, like this:
@helper.form(controllers.common.routes.CMS.appModeSubmit, 'id -> "form") 

