Follow data in file in realtime and import them if data in file was changed. Ruby script

@GeorgeGrot
Oops … I see an error in process_data() method, in file “main.rb”.
It is missing a line …
model = Sketchup.active_model

And another booboo …
Same file, same method.
Before the listener can be restarted, the @last_mod_time needs to be updated.
So insert a line into the method just after stopping the listener (2nd line of the method,) to call the get_mod_time() method. (You want to do it as soon as possible after noting that the time is newer, because it’s possible whilst moving the robot that the file is getting updated again.)

The updated method should look like …

    def process_data
      stop_listener()
      get_mod_time()
      import_data()
      model = Sketchup.active_model
      model.start_operation(OPNAME)
      ###
        #
        move_robot()
        #
      ###
      model.commit_operation
      start_listener()
    end