I have an existing Python class that is used for data capture. It has start() and stop() methods to start and stop the data capture. Right now this class is used in a single Python script, e.g.:
dataGrabber = DataGrabber()
dataGrabber.start()
# do a bunch of stuff...
dataGrabber.stop()
We want to break out the start and stop functionality and be able to start and stop the data capture from the command line, e.g.:
python CaptureData.py start
<<< go off and do something else >>>
python CaptureData.py stop
I need a way for CaptureData.py to create an instance of the DataGrabber class when the script is called with the "start" argument, save that class instance somehow, and have it be accessible when I call the script with the "stop" argument.
I tried using shelve, but the DataGrabber class has tons of instance methods, and Python can't pickle instance methods.
Any ideas? Is there any way I can do this?