In your model you can do: from gluon import current from gluon.storage import Storage current.model_functions = Storage(func1=func1)
and then access current.model_functions.func1 in the module. But a better approach would probably be to define the shared functions in a module somewhere, and then import the functions in both your model files and your other modules. Anthony On Sunday, January 15, 2017 at 8:11:54 AM UTC-5, LightOfMooN wrote: > > Hello! > > How can I import some function from models to my module? > > for example: > > mymodel.py: > def func1(): > return 'qwe' > > > how to call this function from > mymodule.py? > > I found just one solution: > in mymodule.py: > from gluon import current > current.globalenv['func1']() > > It works, but I'm not sure that it's the right thing to do. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

