First, you don't import models -- they are automatically executed by the 
framework. Instead, you import modules (which can be anywhere in the usual 
Python sys.path, or in your application's /modules folder).

Also, local_import has been deprecated. You can now import modules from 
your application's /modules folder by simply doing:

import mymodule  # assuming there is a mymodule.py in 
/applications/myapp/modules

To have the module reload automatically when there are changes, do:

from gluon.custom_import import track_changes
track_changes(True)

To import modules from another app:

from applications.otherapp.modules import mymodule

See 
http://web2py.com/book/default/chapter/04#Accessing-the-API-from-Python-modules.

Anthony


On Thursday, December 1, 2011 8:30:22 AM UTC-5, Alan Etkin wrote:
>
> I would like to be able to change by a model/controller instruction to
> change the path from where the modules are imported,
>
> Suppose my web2py app is stored at ~/web2py/applications/myweb2pyapp
>
> Instead making local_import("model") for a model stored at myweb2pyapp/
> models/model.py, i need to make the same statement for a model stored
> at ~/another/path/module.py
>
> Is that possible? Note that i do not really know what local_import
> does but i been told that it is required to update a modified module
> without web server restart.
>
> Thank you
>
>

Reply via email to