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

  • Home
  • SEARCH
  • 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 9066165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:40:42+00:00 2026-06-16T16:40:42+00:00

I am relatively quite new to Python and I try to learn the Pythonic

  • 0

I am relatively quite new to Python and I try to learn the “Pythonic” way of doing things to build a solid foundation in terms of Python development. Perhaps what I want to achieve is not Python at all, but I am nonetheless seeking to find out the “right” way to solve this issue.

I am building an application, for which I am creating modules. I just noticed that a module of mine has 7 different .py Python files, all importing 3 different same things. So all these files share these imports.

I tried removing them, and inserting these import to the empty init.py in the folder, but it did not do the trick.

If possible, since these imports are needed by all these module files, I would not like them to be imported in each file one by one.

What can I do to perform the common import?

Thank you very much, I really appreciate your kind help.

  • 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-16T16:40:43+00:00Added an answer on June 16, 2026 at 4:40 pm

    As the Zen of Python states, “Explicit is better than implicit”, and this is a good example.

    It’s very useful to have the dependencies of a module listed explicitly in the imports and it means that every symbol in a file can be traced to its origin with a simple text search. E.g. if you search for some_identifier in your file, you’ll either find a definition in the file, or from some_module import some_identifier. It’s even more obvious with direct references to some_module.some_identifier. (This is also one reason why you should not do from module import *.)

    One thing you could do, without losing the above property, is to import your three shared modules into a fourth module:

    #fourth.py
    import first
    import second
    import third
    

    then…

    #another.py
    import fourth
    
    fourth.first.some_function()
    #etc.
    

    If you can’t stomach that (it does make calls more verbose, after all) then the duplication of three imports is fine, really.

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

Sidebar

Related Questions

So I am relatively new to python, and in order to learn, I have
I am relatively new to WPF, and some things with it are quite foreign
I am relatively new to rails and have been working my way through the
Being relatively new to Python 2, I'm uncertain how best to organise my class
I'm relatively new to Objective-C (mainly using cocoa/apple foundation framework), but a long-time C++
I'm relatively new to Python and wondering how best to import data from multiple
I'm quite new to C# so please bear with me. I'm writing a relatively
I'm relatively new to NHibernate, and I'm trying to do something that seems quite
I'm relatively new to Django and I'm trying to build up my toolbox for
I'm relatively new to iOS development and I have a question that I'm sure

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.