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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:27:39+00:00 2026-05-14T05:27:39+00:00

I have a wxPython application with the various GUI classes in their own modules

  • 0

I have a wxPython application with the various GUI classes in their own modules in a package called gui. With this setup, importing the main window would be done as follows:

from gui.mainwindow import MainWindow

This looked messy to me so I changed the __init__.py file for the gui package to import the class directly into the package namespace:

from mainwindow import MainWindow

This allows me to import the main window like this:

from gui import MainWindow

This looks better to me aesthetically and I think it also more closely represents what I’m doing (importing the MainWindow class from the gui “namespace”). The reason I made the gui package was to keep all the GUI stuff together. I could have just as easily made a single gui module and stuffed all the GUI classes in it, but I think that would have been unmanageable. The package now appears to work like a module, but allows me to separate the classes into their own modules (along with helper functions, etc.).

This whole thing strikes me as somewhat petty, I just thought I’d throw it out there to see what others think about the idea.

  • 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-14T05:27:39+00:00Added an answer on May 14, 2026 at 5:27 am

    Well, this is a quite common pattern and I think it is also the reason why you can include things inside __init__.py files.
    As a confirmation, just grep for import statements in __init__.py files, and you will see that it is widely used in both standard library and common packages.

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

Sidebar

Related Questions

I have complex GUI application written in Python and wxPython. I want it to
I have a Python/wxPython program where the GUI is the main thread and I
I have a wxPython application that relies on an external config file. I want
I have a wxPython application I'm bundling into an exe using py2exe. I've defined
I have a application written in wxPython which I want to make multilingual. Our
I have a wxPython application which allows the users to select items from menus
I have a GUI application that needs to do something simple in the background
I have a wxPython application that needs to know when a certain file gets
I have a wxPython application that uses pyinotify (via ThreadedNotifier) to check when a
I have Windows Vista 64-bit SP2. I am trying to use wxPython for GUI

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.