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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:31:50+00:00 2026-06-17T18:31:50+00:00

So, first off here’s my code: import threading print Press Escape to Quit class

  • 0

So, first off here’s my code:

import threading

print "Press Escape to Quit"

class threadOne(threading.Thread): #I don't understand this or the next line
    def run(self):
        setup()

    def setup():
        print 'hello world - this is threadOne'


class threadTwo(threading.Thread):
    def run(self):
        print 'ran'

threadOne().start()
threadTwo().start()

So, the problem is that within my class ‘threadOne’ the run function runs (as that is called by the threading module) but from there I can not called any other functions. That includes if I make more functions beneath the setup() function. For example above, in my run(self) function I try and call setup() and get ‘NameError: global name ‘setup’ is not defined’.

Does anybody have any ideas or can they explain this to me?

Sam

  • 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-17T18:31:52+00:00Added an answer on June 17, 2026 at 6:31 pm

    setup is a method of your Thread instance. Therefore, you call it with self.setup() rather than setup(). The latter is trying to call a global function named setup which does not exist.

    Since setup() is an instance method, it must accept self as its first parameter as well.

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

Sidebar

Related Questions

First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
So, first off here's my code to open the dotx and create a new
First off, here's my code: var variable1 = 10; function f1 (){ alert(variable1); }
Making a server in java, First off, Here's the code. AnsiConsole.out.println(This is a Test.);
First off here is my code. IEnumerable<XElement> targetDirectory = from XElement e in workingXmlDocument.Descendants(wixNS
first off here's my current code. <div id=background> <img src=src/1080pTux.png height=100%> </div> #background{ position:fixed;
Having a bit of CSS problem here. First off, my HTML code: <p> <span
First off here is my code: CREATE FUNCTION unknown_Model () RETURNS TRIGGER LANGUAGE plpgsql
First off, here is some code: int main() { int days[] = {1,2,3,4,5}; int
First off, here's my code: Sub SimulatePortfolio() Dim lambda As Double Dim num As

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.