Click here to Skip to main content
15,917,971 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi! I have a variable, that i use to execute a method from another module. The thing is, that when it's terminated... i cannot start it again. Is it possible to restart-refresh or something similar, the instance of this class ? Here is a sample code of what my application looks like:

Python
ProcessVariable = Process(target=modulename.methodname)

while(True):
  command = raw_input("Enter an command: ")
  if(command == "start_the_process"):
     ProcessVariable.start()
  if(command == "stop_the_process")
     ProcessVariable.terminate()
  #there are otherother commands ofcourse
  #this stacture cannot be changed at any manner.


What I have tried:

One thinng i though, as an extremely extreme solution, is to create a list of instances, and everytime use a different one... but this is not a good solution... for obvious reasons...
Posted
Updated 15-Mar-17 8:41am
v2

1 solution

I found a solution. I created a list, where i was able to create new object, then use them. When i didn't want them anymore... i delete them from the list.
 
Share this answer
 
Comments
Graeme_Grant 28-Aug-17 20:28pm    
Please do not post solutions to your own problems, then flag as answered. This is considered reputation farming and can get you kicked.

Instead, include this update in the Question by clicking on the "Improved question" widget above. Once done, please delete this solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900