Checking sensors in an environment I have the following diagram (did this only to ask here, it's obviously missing details):



From the diagram you can see I have to check if all sensors in an environment are respecting the established conditions, but I'm not comfortable with the way I'm implementing this...

class Environ:

    def __init__(self):
        self.load_conditions()
        self.load_modules()

    def load_modules(self):
        self.modules = []
        # Don't like this!
        m = Module(self.conditions)
        self.modules.append(m) 

    def run_modules(self):
        for m in self.modules:
             m.process_sensors()

class Module:

    def __init__(self, conditions):
        self.conditions = conditions
        self.load_all_sensors()

    def load_all_sensors(self):
        self.sensors = []
        # Don't like this!
        s = Sensor(self.conditions)
        self.modules.append(m) 


      def process_sensors(self):
         for s in sensors:
             if not s.is_sensor_respecting_conditions():
                 raise ...

e = Environ()
e.run_modules()


My question is: do I really have to replicate all these conditions? What can I do to make this code more clean?
The idea with objects is they maintain the data that they own. Try to avoid having the object hold onto other data just because it uses it. This makes later refactoring harder.
Below is a sketch of what the process chain might look like.

class Sensor(object):
    def process(self, conditions):
        if not self.is_respecting_conditions(conditions):
            raise Exception("Fill me in properly")

        self.apply(conditions)

class Module(object):
    def process(self):
        for s in self.sensors:
            try:
                s.process(self.conditions)
            except:  # Handle actual exception here
                pass  # whatever work is needed

class Environment(object):
    def process(self):
        for m in self.modules:
            m.process()


This assumes that the conditions are per module. If they are per Environment then you could would add the condition parameter to the process method of the Module object.