title: BeautifulSoup writes html successfully but find_all returns nothing
body: <p>I am using BeautifulSoup to create and write html file . I am able to create a simple html as shown below for MWE. However, all find functions return nothing, so unable to perform further operations (insert, append). </p>
  
  <ol>
  <li>What is happening?  </li>
  <li>How do I set a style to one of the divs alone?  (for eg, div2 and div3 shoudl have display:none which later I plan to enable via script)</li>
  </ol>
  
  <p><strong>MWE:</strong>  </p>
  
  <pre><code>head_soup = BeautifulSoup(open(nbheader_template),"html.parser")
  head_soup.contents[0]
  
  base_template = "&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;/html&gt;"
  main_soup = BeautifulSoup(base_template,"html.parser")
  
  main_soup.html.append(head_soup)  # add nbconver header
  
  # INSERT THE BODY AS IT IS
  # bodies = [body.replace('&lt;body&gt;','').replace('&lt;/body&gt;','') for body in bodies]  # no need of body tags
  bodies = ['&lt;div&gt;Test div' + str(i+1) + '&lt;/div&gt;' for i in range(3)] # for MWE
  body_tag = main_soup.new_tag('body')
  for each_body in bodies:
      body_tag.append(BeautifulSoup(each_body,'html.parser'))
  main_soup.html.insert(1,body_tag)    
  
  
  with open(output_filename, "w") as file:
      file.write(str(main_soup))
  
  print(main_soup.find_all('head'))
  print(main_soup.html.find_all('head'))
  print(main_soup.find_all('body'))
  print(main_soup.html.find_all('body'))
  print(main_soup.find_all('div'))
  print(main_soup.html.find_all('div'))
  </code></pre>
  
  <p><strong>Output:</strong><br>
  <a href="https://i.stack.imgur.com/1cBUD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1cBUD.png" alt="enter image description here"></a></p>
  
  <p><strong>File Output:</strong><br>
  <a href="https://i.stack.imgur.com/3gCE3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3gCE3.png" alt="enter image description here"></a></p>
  
  <p><strong>Context</strong>: I am trying to combine multiple jupyter notebook html files. After this update, I need to add styles to individual divs corresponding to each html (each notebook) file. </p>
  
  <p><a href="https://www.codepile.net/pile/Jx1J1w3O" rel="nofollow noreferrer">Here</a> is the nbviewer head</p>