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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:31:50+00:00 2026-06-08T22:31:50+00:00

I am starting a loop in python, and after I start the loop I

  • 0

I am starting a loop in python, and after I start the loop I want the execution of code after the loop to carry on, while the loop keeps looping (in the ‘background’).

x=True

while x:
  #do some output
  sleep(1)

#ask for input or something
if input()=='something':
  x=False

So in that example, #do some output will keep happening while input is asked for.

Is this possible in python? Are there any work-arounds that could achieve this?

  • 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-08T22:31:52+00:00Added an answer on June 8, 2026 at 10:31 pm

    Following OP’s wish I’m posting the answer. 🙂 There are multiple libraries for achieving what you are trying to do. Most known include:

    • threading module
    • multiprocessing module

    There are subtle differences between them, but I guess that you shouldn’t worry about it at the moment. I encourage you though to read more about mutli-processing and threading in general. Also “green” threads is an interesting alternative.

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

Sidebar

Related Questions

in Python how do i loop through list starting at a key and not
I want to launch a background Python job from a bash script and then
I have a simple python script that just runs an infinite while loop and
I'm just starting to play around with Python (VBA background). Why does this dictionary
Starting a new rails project and we have a well-thought-out color palette, and want
I am starting with multi-threads in python (or at least it is possible that
I am writing some signal processing software, and I am starting off by writing
I recently starting playing around with the new features of Python 3.1 and porting
I'm starting out in python.. The details I have written in the below.. It
I am just starting out with Python and decided to try this little project

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.