code: def resolve(tex):
      
  
      # soupify
      soup = TexSoup(tex)
  
      # resolve subimports
      for subimport in soup.find_all('subimport'):
          path = subimport.args[0] + subimport.args[1]
          subimport.replace_with(*resolve(open(path)).contents)
  
      # resolve imports
      for _import in soup.find_all('import'):
          _import.replace_with(*resolve(open(_import.args[0])).contents)
  
      # resolve includes
      for include in soup.find_all('include'):
          include.replace_with(*resolve(open(include.args[0])).contents)
  
      return soup
docs: Resolve all imports and update the parse tree.
  
      Reads from a tex file and once finished, writes to a tex file.