<p dir="ltr">If you add your stuff to startup.py in qgis2\python </p>
<p dir="ltr">Nathan <br>
</p>
<br><div class="gmail_quote">On Sat, 28 Mar 2015 12:18 am Caroline Alexiou <<a href="mailto:carolinegr@gmail.com">carolinegr@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hello,<br></div>I want to have some helper functions available in the Python console within qgis, for instance this:<br>def a():<br>    return iface.activeLayer()<br></div>so that I type less things. I tried to start qgis with the --code argument but this didn't work. I also tried to put this function in the .qgis2/python/startup.py but when I am in the console a() is not recognized. I can create <br><br>@qgsfunction(0, "Python") <br>   def a(v,f,p):<br>       return iface.activeLayer()<br><br></div>in startup.py but then I'm not sure how I'd use it from within the console. Also, I know I can use scriptrunner to get the function to work, but I am looking to do this on startup, ie I start qgis, go to the console and a() is available. Is this possible within Qgis core or should I look into maybe adapting script runner for my purposes?<br><br></div>Bests,<br></div>Karolina Alexiou<br></div>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a></blockquote></div>