I have 3 scripts written in python.
- an initialization script
- a script that contains a custom data structure class
- a monitoring script.
The initialization script starts first. It creates the object of the custom data structure and then starts the monitoring script. The monitoring script at certain points will send values to fill up the object that was created in the initialization script.
So, basically there is a global data object created by the initialization script. The monitoring script will add data to that object. The data object is like a buffer which contains tasks to be executed later.
How do I accomplish the task of adding data to the data object from the monitor script?
import monitorscript import customDataStructure # creates the object for the customDataStructure # starts the monitor script
custom data structure:
class mydata(object): def __init__(self, arg1 = None, arg2 = None): self.arg1 = arg1 self.arg2 = arg2 class mydata2(mydata): def __init__(self): self.queue =  self.length = 0 def addTask(self, data): # adds a task to be executed into the buffer. self.queue.append(data) # data is a mydata object. self.length += 1 # some other methods.
# from this script I want to be able to add values to the data object created earlier.
If my question is unclear or needs more information, please ask me in the comments. I might very well be missing a whole programming concept over here. So, if you can tell me what I need to look into, I will be very grateful.
In short, I need to be able to update the data object created by one script by using another script. This data object is a buffer which will be processed separately at regular intervals.