#!/usr/bin/env python3
import sys     # standard system modul
import os      # miscellaneous operating system interfaces

fN = 'counting.txt'

if not os.path.isfile(fN):            # 'is file'
  with open(fN, 'w') as f:            # short for try-catch block 
    f.write("1")

with open(fN, 'r+') as g:             # read and write
  if (var:=int(g.read())) >= 100000:  # exit when too large
    exit()
  print("content of ", fN, " : ", var)
  g.write("0")                        # appending, because did read first

print(sys.argv) 
os.system(sys.argv[0])                # running self
