<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hey Stephen,</p>
    <p>it's not a dumb question at all! The QGIS Python console+editor's
      autocompletion is pretty misleading as it will suggest pretty much
      anything it can find anywhere in the code base, with no regards if
      the object or class you are currently working with actually has
      that "thing". At least that how it seems to me. :}<br>
    </p>
    <p>In my experience it's best to ignore it for programming purposes
      and only treat it as way to save typing some characters.</p>
    <p><br>
    </p>
    <p>As for your errors, "xxx is not an attribute of yyy" means that
      there is no yyy.xxx. This is not something you can import. yyy is
      an object and will be checked live at runtime when Python tries to
      access its xxx attribute (yyy.xxx). If .xxx does not exist for
      yyy, then that's the way it is, you are on the wrong path :)</p>
    <p>You can find out which attributes and methods your objects have
      by using dir(yyy) or via the API documentation via help(yyy) or
      online at <a class="moz-txt-link-freetext" href="https://qgis.org/pyqgis/master/index.html">https://qgis.org/pyqgis/master/index.html</a> (make sure to
      choose the correct version corresponsing to your QGIS).<br>
    </p>
    <p>Cheers, Hannes<br>
    </p>
    <div class="moz-cite-prefix">Am 28.03.22 um 18:33 schrieb Stephen
      Sacks via Qgis-user:<br>
    </div>
    <blockquote type="cite"
      cite="mid:eff83473-b886-b159-cd9b-3d885b626331@gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <font size="4">Please pardon what may be a dumb question from a
        self- (half-) taught student of Python.  I often steal fragments
        of code from the internet (especially including this forum) and
        sometimes get an error message like  "xxx is not an attribute of
        yyy" .  My  problem, I think, is a missing  " from xyz import
        abc".  My question to you now is whether there is some way to
        know what to import, and from which module, for any particular
        Python statement.  More specifically, I get this error message:<br>
        <br>
          AttributeError: 'QgsEditFormConfig' object has no attribute
        'setHidden'<br>
        <br>
        when I run the following code:<br>
        <br>
        from qgis.core import QgsProject<br>
        from qgis.core import *<br>
        from qgis.utils import iface<br>
        from qgis.core import *  <br>
        from PyQt5.QtWidgets import QInputDialog<br>
        from PyQt5.QtWidgets import *<br>
        from qgis.PyQt.QtCore import * <br>
        from qgis.gui import *   <br>
        <br>
        def oneA( lyr, columnName, option ): <br>
            flds= lyr.fields()<br>
            indx = flds.indexOf(columnName)<br>
            config = lyr.editFormConfig()<br>
            config.setHidden(indx, option)<br>
            lyr.setEditFormConfig(config)<br>
        <br>
        lyr = iface.activeLayer()<br>
        aField =  'NAME'  <br>
        oneA (lyr, aField, True)<br>
        <br>
        When I type this code in the QGIS environment, autocompletion
        leads me to believe that "setHidden" is allowed after "config."
        but I must admit I don't understand the meaning of the several
        choices specified in the parentheses.  I'd be grateful if
        someone would explain that to me.  Also,  am I correct in
        thinking that an asterisk following "import" means "everything
        in this module"?<br>
           I'm running QGIS  3.16.3  under Windows 10.<br>
           Thanks in advance for any help.</font></blockquote>
    <br>
  </body>
</html>