Python as an import mechanism. import mymodule
and as long as mymodule is in a folder that is in sys.path everything works. This works in web2py as in any other other Python application. web2py provides a folder web2py/site-packages where you can put your modules and it will be added to the path. web2py also allows you to import modules that ARE NOT stores in a folder listed in sys.path. Why? Because sys.path is not thread safe. The Python import mechanism does not allow you to have two modules with the same name by web2py allows you to run different apps which may need to have different modules with the same name, for example different versions of the same module. So web2py allows you to do something extra: place a module in applications/myapp/modules and import it with mymodule=local_import(mymodule) This is a hack and workaround that allows you to import a module without adding its folder to sys.path. This comes with limitations. If the module needs to import other files, the imports must be relative imports and not absolute imports. On Jun 16, 10:19 pm, pierreth <[email protected]> wrote: > On 14 juin, 08:11, mdipierro <[email protected]> wrote: > > > It depends. If you want to import any NORMAL python module, put it in > > site packages and import it using normal python syntax. > > > If you want to import "web2py modules", i.e. modules that belong to a > > specific application only, then you have to follow the rules and not > > all modules can be imported this way. > > I don't understand. Could you explain?

