title: PyQt load function on startup (qml loader)
body: <p>Hi i have the following problem :</p>
  
  <p>this is my working code </p>
  
  <pre><code>import sys
  from PyQt5.QtCore import QObject, QUrl, Qt
  from PyQt5.QtWidgets import QApplication
  from PyQt5.QtQml import QQmlApplicationEngine
  import os
  import vlc
  from time import sleep
  
  # define VLC instance
  instance = vlc.Instance()
  
  # Define VLC player
  instance = vlc.Instance('--input-repeat=-1', '--fullscreen')
  
  player = instance.media_player_new()
  
  
  list_test = []
  list_name = []
  
  
  def prepare_url(url):
  
  media = instance.media_new(url)
      player.set_media(media)
  
  
  if __name__ == "__main__":
  os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material"
  app = QApplication(sys.argv)
  
  engine = QQmlApplicationEngine()
  ctx = engine.rootContext()
  ctx.setContextProperty("main", engine)
  engine.load('SimpleQML.qml')
  
  win = engine.rootObjects()[0]
  win.show()
  button = win.findChild(QObject, "playBtn")
  
  
  def myFunction():
      print("A fine piece of text")
  
  
  
  button.clicked.connect(myFunction)  # works on click
  myFunction() #works with out clicking
  
  sys.exit(app.exec_())
  </code></pre>
  
  <p>Now i would like to expand on that by doing the following code :</p>
  
  <pre><code>import sys
  from PyQt5.QtCore import QObject, QUrl, Qt
  from PyQt5.QtWidgets import QApplication
  from PyQt5.QtQml import QQmlApplicationEngine
  import os
  import vlc
  from time import sleep
  
  # define VLC instance
  instance = vlc.Instance()
  
  # Define VLC player
  instance = vlc.Instance('--input-repeat=-1', '--fullscreen')
  
  player = instance.media_player_new()
  
  
  list_test = []
  list_name = []
  
  
  def prepare_url(url):
  
  media = instance.media_new(url)
  
  player.set_media(media)
  
  
  if __name__ == "__main__":
  os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material"
  app = QApplication(sys.argv)
  
  engine = QQmlApplicationEngine()
  ctx = engine.rootContext()
  ctx.setContextProperty("main", engine)
  engine.load('SimpleQML.qml')
  
  win = engine.rootObjects()[0]
  win.show()
  button = win.findChild(QObject, "playBtn")
  comboBox = win.findChild(QObject, "comboBox")
  
  def myFunction():
      print("das")
  
  def list_fill():
      with open("config/stations.txt") as f:
          content = f.readlines()
          content = [x.strip() for x in content]
          list_t = [item.split("|")[0] for item in content if item]
          list_n = [item.split("|")[1] for item in content if item]
          del list_test[:]
          del list_name[:]
          comboBox.clear()
          for x in list_t:
              list_test.append(x)
          for x in list_n:
              list_name.append(x)
  
          addItems(list_name)
  
  button.clicked.connect(myFunction)  # works too
  myFunction()
  list_fill()  #calling this crashes program
  sys.exit(app.exec_())
  </code></pre>
  
  <p>and at the very end this is the error </p>
  
  <pre><code>    das
  Traceback (most recent call last):
   File "/home/flea/Desktop/quick qt/main.py", line 65, in &lt;module&gt;
    list_fill()
   File "/home/flea/Desktop/quick qt/main.py", line 55, in list_fill
   comboBox.clear()
  AttributeError: 'QObject' object has no attribute 'clear'
  </code></pre>
  
  <p>i tried to do ti with hardcoded list, but list is not the problem, for some reason my combo box is not recognized by python.I am not sure what is the problem here.
  I can load my button and add a click event to it, (which works), but i cant add list to my comboBox.</p>
  
  <p>here is my Qml</p>
  
  <pre><code> import QtQuick 2.10
  import QtQuick.Controls 2.1
  import QtQuick.Window 2.2
  import QtQuick.Controls.Material 2.3
  
  
  
  ApplicationWindow {
  id: applicationWindow
  Material.theme: Material.Light
  title: qsTr("Test Invoke")
  
  width: 600
  height: 500
  
  Row {
      id: row
      width: 200
      height: 400
      anchors.left: parent.left
      anchors.leftMargin: 5
      anchors.top: parent.top
      anchors.topMargin: 5
  
      Button{
          id: playBtn
  
  
          objectName: "playBtn"
          text : "Play"
          checked: false
          padding: 6
          rightPadding: 8
          font.wordSpacing: 0
          font.pointSize: 10
          font.family: "Times New Roman"
          topPadding: 4
          highlighted: true
          Material.accent: Material.Red
  
  
  
      }
  
      Button {
          id: stopBtn
          objectName: "stopBtn"
          text: qsTr("Stop")
          anchors.left: playBtn.right
          anchors.leftMargin: 5
      }
  
      Button {
          id: stfBtn
          text: qsTr("Save")
          objectName: "stfBtn"
          anchors.left: stopBtn.right
          anchors.leftMargin: 5
      }
  
      Button {
          id: minimize
          objectName: "minBtn"
          text: qsTr("Min")
          anchors.left: stfBtn.right
          anchors.leftMargin: 5
      }
  }
  
  Column {
      id: column
      x: 135
      y: 100
      width: 200
      height: 400
  
      TextField {
          objectName: "nameText"
          id: nameText
          width: 300
          text: qsTr("")
      }
  
      TextField {
          objectName: "urlText"
          id: urlText
          width: 300
          text: qsTr("")
      }
  
      ComboBox {
          objectName: "comboBox"
          id: comboBox
          width: 200
      }
  }
  
  Slider {
      id: slide
      objectName: "slider"
      x: 160
      y: 311
      value: 0.5
  }
  
  
  
  
  }
  </code></pre>