Forum

Author Topic: Where to define functions?  (Read 1332 times)

KBL

  • Newbie
  • *
  • Posts: 31
    • View Profile
Where to define functions?
« 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?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: Where to define functions?
« Reply #1 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.
Best regards,
Alexey Pasumansky,
Agisoft LLC