title: Gettig error: object of type...has no len()
body: <p>I'm trying to get PMI count from work part file which is opened in NX software in Python, but getting error:</p>
  
  <pre><code>TypeError: object of type 'NXOpen.Annotations.PmiCollection' has no len()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6VnDv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6VnDv.jpg" alt="enter image description here"></a>
  Code:</p>
  
  <pre><code>lw = theSession.ListingWindow
  lw.Open()
  theSession  = NXOpen.Session.GetSession()
  theParts = theSession.Parts
  theWorkPart = theParts.Work
  allPMIObjects = theWorkPart.PmiManager.Pmis
  count1 = len(allPMIObjects)
  lw.WriteLine(count1)
  lw.Close()
  </code></pre>
  
  <p>Documentation link: <a href="https://docs.plm.automation.siemens.com/data_services/resources/nx/11/nx_api/custom/en_US/nxopen_python_ref/NXOpen.Annotations.PmiCollection.html" rel="nofollow noreferrer">https://docs.plm.automation.siemens.com/data_services/resources/nx/11/nx_api/custom/en_US/nxopen_python_ref/NXOpen.Annotations.PmiCollection.html</a></p>
  
  <p>Equivalent vb code: <a href="http://nxjournaling.com/content/find-out-if-part-has-any-pmi" rel="nofollow noreferrer">http://nxjournaling.com/content/find-out-if-part-has-any-pmi</a></p>