Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: KBL on November 15, 2018, 01:26:59 PM

Title: Where to define functions?
Post by: KBL on November 15, 2018, 01:26:59 PM
Hey all, I have a few bits of code that I'd like to call as functions. It seems possible to define functions inline, but it does clutter the script up somewhat. Is there any way to define functions in a different file and import them while still running the script from inside PhotoScan, or is that not possible?
Title: Re: Where to define functions?
Post by: Alexey Pasumansky on November 19, 2018, 01:35:09 PM
Hello KBL,

You can use Python modules approach:
https://docs.python.org/3/tutorial/modules.html
https://www.tutorialspoint.com/python/python_modules.htm

However, you would likely need to pass the chunk or document as an argument to the function, if it is dealing with the chunks.