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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:32:01+00:00 2026-05-16T03:32:01+00:00

For example, if one application does from twisted.internet import reactor , and another application

  • 0

For example, if one application does from twisted.internet import reactor, and another application does the same, are those reactors the same?

I am asking because Deluge, an application that uses twisted, looks like it uses the reactor to connect their UI (gtk) to the rest of the application being driven by twisted (I am trying to understand the source). For example, when the UI is closed it simply calls reactor.stop().

Is that all there is to it? It just seems kind of magic to me. What if I wanted to run another application that uses twisted?

  • 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-16T03:32:02+00:00Added an answer on May 16, 2026 at 3:32 am

    Yes, every module in Python is always global, or, to put it better, a singleton: when you do from twisted.internet import reactor, Python’s import mechanism first checks sys.modules['twisted.internet.reactor'], and, if that exists, returns said value; only if it doesn’t exist (i.e., the first time a module is imported) is the module actually loaded for the first time (and stashed into an entry in sys.modules for possible future imports).

    There is nothing especially magical in the Singleton design pattern, though it can sometimes prove limiting when you desperately need more than one of those thingies for which the architecture has decreed “there can be only one”. Twisted’s docs acknowledge that:

    New application code should prefer to
    pass and accept the reactor as a
    parameter where it is needed, rather
    than relying on being able to import
    this module to get a reference. This
    simplifies unit testing and may make
    it easier to one day support multiple
    reactors (as a performance
    enhancement), though this is not
    currently possible.

    The best way to make it possible, if it’s crucial to your app, is to contribute to the Twisted project, either labor (coding the subtle mechanisms needed to support multiple reactors, that is, multiple event loops, within a single app) or funding (money will enable sustaining somebody with a stipend in order to perform this work).

    Otherwise, use separate processes (e.g. with the multiprocessing module of the standard library) with no more than one reactor each.

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

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer UIModalPresentationFullScreen is only available in the 3.2 (and above) SDK… May 16, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer I had to do this and since you are working… May 16, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer It is a heavy implementation detail of the JIT compiler.… May 16, 2026 at 11:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I just upgraded my application from Rails 2.3 to 3 and I'm getting some
Does anybody know any reasons why IMemAllocator:GetBuffer (Directshow) hangs, apart from all samples being
When I try to omit dots from method invocations, like in this example program:
I have an application running in IIS which connects to a SQL Server 2008
I'm familiar with Computer Vision ( Well, know OF it ), of which one
I'm trying to determine my options for clustering my ServiceMix 3.3.1/Camel 2.1/AMQ 5.3 application.
i am using newrelic (developer mode) for monitoring my rails application. strangely, loading the
I have a GUI application in swing, implemented in NetBeans. For the various functionality
My application is simple, I have 2 pages: RSSProducer.aspx: A page that generates RSS
I have a Java application with server and Swing client. Now I need to

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.