title: python: how to use a variable (time_convert)of a class (stopwatch)in other python3 script
body: <pre><code>class stopwatch(object):
      def __init__(self):
          global time_convert,time_convert1,draw,start_time,padding,padding_2,top,top_2,x,x_2,font,font_2,image,width,height
          #self.width = width
         # self.height = height
          #self.image = image
          #self.draw = draw
          #self.padding = padding
          #self.padding_2 = padding_2
         # self.top = top
          #self.top_2 = top_2
         # self.font = font
         # self.font_2 = font_2
      def main():
          global time_convert,time_convert1,draw,start_time,padding,padding_2,top,top_2,x,x_2,font,font_2,image,width,height
          global flag
          flag = True #flag = True #flag x ciclo while
      #reset display
          disp.begin()
          disp.clear()
          disp.display()
      #preparazione display con immagine vuota
          width = disp.width
          height = disp.height
          image = Image.new('1', (width, height))
          draw = ImageDraw.Draw(image)
          draw.rectangle((0,0,width,height), outline=0, fill=0)
      #ridimensionamento caratteri padding= alza/abbassa carattere, x= destra/sinistra carattere
          padding = 0
          padding_2 = 3.5 # per carattere decimali più piccolo
          top = padding
          top_2 = padding_2 # per carattere decimali più piccolo
          x = 10
          x_2 = 75 # per carattere decimali più piccolo
          
          font = ImageFont.truetype('/home/albe/Documents/Progetti/schiuma150/Calculator.ttf',30)
          font_2 =ImageFont.truetype('/home/albe/Documents/Progetti/schiuma150/Calculator.ttf',20)
          #print(&quot;Press button red to start and green to stop&quot;)
          #GPIO.wait_for_edge(23,GPIO.FALLING)
          #print(&quot;crono iniziato&quot;)
      #def run():
       #   global time_convert,time_convert1,draw,start_time,padding,padding_2,top,top_2,x,x_2,font,font_2,image,width,height
        #  flag = True
          start_time = time.time()
          while (flag):
              #global time_convert,time_convert1,draw,start_time,padding,padding_2,top,top_2,x,x_2,font,font_2,image,width,height
              #global flag
              current_time = time.time()
              timer = current_time - start_time
              sec =  int (timer)
              decs = math.modf(timer)
              decs1 = int (decs[0]*60) #parte decimale
              sec1 = int(sec % 60)
              mins = int(sec // 60)
          #hour = int(mins // 60)
          #time_convert =&quot;{:02n}:{:02n}:{:02n}:&quot;.format(hour,mins,sec1)#creazione indice x formattazione
              time_convert =&quot;{:02n}':{:02n}'':&quot;.format(mins,sec1)#creazione indice x formattazione
              time_convert1 =&quot;{}&quot;.format(decs1) # per carattere decimali più piccolo
              return time_convert
              return main.time_convert1
              draw.text((x, top),str(time_convert),font=font,fill=255), draw.text((x_2, top_2),str(time_convert1),font=font_2,fill=255)
              disp.image(image)
              disp.display()
              draw = ImageDraw.Draw(image)
              draw.rectangle((0,0,width,height), outline=0, fill=0)
              #print(&quot;crono run&quot;)
              #x = 0
              #cam = os.popen(&quot;./vcmipidemo-pi3 -i 1 -s 2180250 -g 0x88 -o &amp;&amp; mv img00000.pgm /home/albe/Documents/Progetti/schiuma150/test_images/all_img/img&quot;+str(x)+&quot;.pgm&quot;)
              #time.sleep(1)
              #img = Image.open(&quot;/home/albe/Documents/Progetti/schiuma150/test_images/all_img/img&quot;+str(x)+&quot;.pgm&quot;)
              #x +=1
              #draw = ImageDraw.Draw(img)
              #font = ImageFont.truetype(&quot;Calculator.ttf&quot;, 25)
              #draw.text((500, 350), text= str('Timer: ' + time_convert + time_convert1) ,fill=255,font=font)
              #img.save('/home/albe/Documents/Progetti/schiuma150/test_images/results/img'+str(x)+'stamp.pgm')
             # print(&quot;image saved&quot;)
          else:
              exit()
      if __name__ == '__main__': main()
      
  </code></pre>