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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:25:16+00:00 2026-05-31T11:25:16+00:00

I use Qt + PyQt for developing. My application is very-very big (20 MB

  • 0

I use Qt + PyQt for developing. My application is very-very big (20 MB of source code). It includes many different menus and widgets. Very oftne I change only 1 string on method in some widget. But for checking changes I switch off my application, relaunch it, go to menu1 -> menu2 …. and only after this step I can check changes.

How can I reload methods for only one class/widget? Without close/open whole application?

  • 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-31T11:25:17+00:00Added an answer on May 31, 2026 at 11:25 am

    My general reply to this would be no, its not possible in a straight-forward fashion. The main issue is that when you start your app, it loads everything into memory, and your classes have their methods bound, etc… So in order to update say, values you changed of a method of a class, you would have to destroy that class (or widget) and recreate it under the updated source (which would also kill the children).

    Its bad looking, but it would look something like this:

    ## main.py ##
    
    class MainWindow(QtGui.QMainWindow):
    
        def __init__(self, *args, **kwargs):
            super(MainWindow, self).__init__(*args, **kwargs)
            self.resize(640,480)
            self.central = widget.Widget()
            self.setCentralWidget(self.central)
    
            self.toolbar = QtGui.QToolBar()
            self.toolbar.addAction("Reload Entire Widget", self._reloadWidget)
            self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar)
    
        def _reloadWidget(self):
            print "Reloading", widget
            reload(widget)
            self.central.deleteLater()
            self.central = widget.Widget()
            self.setCentralWidget(self.central)
    
    ## widget.py ##
    
    class Widget(QtGui.QWidget):
    
        def __init__(self, *args, **kwargs):
            super(Widget, self).__init__(*args, **kwargs)
            self.layout = QtGui.QVBoxLayout(self)
            self.button = QtGui.QPushButton("Click")
            self.layout.addWidget(self.button)
    
            self.button.clicked.connect(self.testMethod)
    
        def testMethod(self):
            print "testmethod(): FOO"
    

    Again, I think this approach is problematic and difficult to deal with since you have to destroy and recreate your widget. More problems occur when parts of your app have signals bound to slots of this widget being updated. You then also have to reload their modules and relink their signals. It becomes a big dependency tree situation. Its hard enough to do with standard python script, let alone trying to do it with something much more persistant and dynamic like the PyQt framework.

    Basically, don’t rely on this ability. You are better off maybe setting up something with QTest to simulate your repetitive tasks.

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

Sidebar

Related Questions

I'm starting a basic application using Python and PyQt and could use some experienced
I want to use a PyQt application to display an image when some acpi
I'm doing a platform independent PyQt application. I intend to use write a setup.py
I got a QtWebKit.QWebView widget in a PyQt application window that I use to
What Python-related code (PyGTK, Glade, Tkinter, PyQT, wxPython, Cairo, ...) could you easily use
I'm trying to use pyqt to show a custom QDialog window when a button
I have a TextEdit widget in PyQt that I use to print out a
Use case: 3rd party application wants to programatically monitor a text file being generated
I'm developing an application in PyQt4 that eventually has to open and show PDF
I'm writing a PyQt (Python bindings for the all-powerful Qt library) application and a

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.