Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:31:48+00:00 2026-05-23T13:31:48+00:00

I have split the code into multiple files. I have imported all the functions

  • 0

I have split the code into multiple files. I have imported all the functions from all other files into admin.py. Lets say I want to call a function XYZ. If I give path to function as admin/XYZ it gives me error as invalid function and for this I have to give the path as file_with_XYZ_function/XYZ.

Is there a way to overcome this problem and simple call all the imported functions from one single file

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:31:48+00:00Added an answer on May 23, 2026 at 1:31 pm

    NOTE: This might not be answering your question as I’m not sure I understand your question…

    But if you want to put some code into a (shared) module and include it from several of your controllers I suggest that you have a look at chapter four (The Core) of the web2py book and search for local_import.

    For this kind of situation, web2py
    provides another way to import modules
    in such a way that the global sys.path
    is not altered: by placing them in the
    “modules” folder of an application.
    One side benefit is that the module
    will be automatically copied and
    distributed with the application;
    however, there are certain
    restrictions that apply. web2py
    provides a local_import function that
    must be used to import modules from
    the “modules” folder.

    The import of modules depends on the modules and where web2py can find them. If it is a standard module which web2py can find in sys.path or in web2py/site-packages import modulename should work as expected.

    For modules local to your app web2py offers something else: applications/appname/modules

    Those modules can be imported using local_import.

    mymodule = local_import(themodule)

    This imports the module with the name themodule in the apps local modules folder and makes it available under the name mymodule. Note that local_import supports two additional arguments: reload and app. During development module code often changes so don’t forget to tell web2py to reload the module upon each request with the parameter reload=True, otherwise you won’t see your changes unless you restart web2py.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the process of changing some code, I have spilt some functions into multiple
Let's say I have a split view, and I want to fill half of
I have a XSLT which will split large xml file into multiple xml file
I have the following code, which splits up a Vector into a string vector
I have a code-base that I'm looking to split up and add to by
When I using the following code to read file: lines=file(data.txt).read().split(\n) I have the following
I have a windows forms app where I have split different functionality into several
I want to use some functions from a .cpp source file that has a
I'm using LINQ to SQLto import old DBF files into MSSQL. I'm reading all
I am trying to split a collection into multiple collections while maintaining a sort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.