Solved by albanD in post #2 
              
              
                This happens because refinedet_net is None is your code? You want to check why this happens? Did you forgot a return statement maybe?