<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi!<div><br></div><div>I am trying to load a project into qgis when a different project is already loaded by doing this in my plugin:</div><div><br></div><div><div>    QgsProject.instance().clear()</div></div><div><div>    QgsProject.instance().setFileName('d:/shashank/test/second.xml.qgs')</div><div>    QgsProject.instance().read()</div></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">It does not load the project. Interestingly it loads the project when I execute the command in  python console. </span></div><div><span style="font-size: 12pt;">Also it does not work if I put the three lines inside a function and execute the function in python console. </span></div><div><span style="font-size: 12pt;"><br></span></div><div>Thanks in advance</div><div>Shash</div>                                           </div></body>
</html>