This is a philosophical issue before a technical one. if b-app needs a-
app than b-app is not an app because it is not autonomous entity you
can pack and distribute individually. If this is the case, b-app
should be a controller inside a-app or it should app the data of a-app
as a service and not by reading its model files. If this is not the
case and you want to allow both a-app and b-app work individually, you
should make a copy of the models of a-app that you need into b-app. If
they share the same database, make sure that only one of the apps does
migrate=True and the other does migrate=False.

Form a technical point of view you can do what you ask in two ways.

1) you can move the define_tables in a function defined in a module
(not a model) and from model files in both apps, you import the
function and pass database connection (db) to them.

2) you can have one app execfile the model of the other app.

Massimo


On Apr 3, 8:37 pm, hywang <[email protected]> wrote:
> There are 2 applications: a-app and b-app.
>
> I want to import a model in a-app into b-app, is there a easy and safe
> way to do it ?
> thank you !

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to