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 8116913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:58:49+00:00 2026-06-06T03:58:49+00:00

I am practicing with Python using Pyramid framework. I created a py, myfuncs.py ,

  • 0

I am practicing with Python using Pyramid framework.

I created a py, myfuncs.py, in my main package folder where there is also a Views folder with views.py inside and Models folder (models inside) along with other folders for static files and templates (as created by Pyramid scaffolding).

I want to define functions and classes within the myfuncs.py located at the myproject package root and then access them from within any of the views and models located in their respective views and models folder.

How can I achieve this? I try importing but it won’t work.

  • 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-06-06T03:58:50+00:00Added an answer on June 6, 2026 at 3:58 am

    imagine this structures of folders and files:

    MyFuncs (folder)
        __init__.py (can be completely empty)
        utilFunctions.py
        genericFunctions.py
        uselessFunctions.py
        Views (folder)
            __init__.py (again!!)
            views.py
    

    Now you can “import” the folders (in reality you import __ init __.py using the folder name, but this is for now a detail)
    Be sure to have the PYTHONPATH properly set.

    for example:

    import MyFuncs.utilFunctions
    from MyFuncs.Views import views
    import MyFuncs.uselessFunctions as nonsenseFunctions
    

    etc.etc.

    That __ init __.py must be in any folder you wish to import

    Within views.py you simply do:

    from MyFuncs import utilFunctions
    
    utilFunctions.aFunctionYouCode()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just got into python very recently and now I'm practicing by (what I
Started practicing with XML and C# and I have an error message of There
I'm practicing the data visualization library d3.js, and I am using a random data
I'm practicing some XSL and using this XML document as a simple example: <?xml
I'm practicing on Django and using some online tutorial to build a web blog.
I have been practicing my scraping abilities in Python. I have gotten pretty good,
Though there can be many but as i am very new to python so
Alright I am practicing using cURL to login to different webservices. For this pariticular
Which are the most advanced frameworks and tools there are available for python for
I am practicing sending emails with Google App Engine with Python. This code checks

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.