In Frappe, the dotted path for a whitelisted method is the full path of the Python function, starting from the name of the Frappe application, followed by the name of the Frappe module, and then the name of the doctype, and finally the name of the Python function.
In your case, the name of the Frappe application is “pnOctopus”, the name of the Frappe module is “mOctopus”, the name of the doctype is “dOctopus”, and the name of the Python function is “pwd”. Therefore, the dotted path to the pwd method is
The best solution / workaround I can come up with is to place the function in a file ssOctopus.py, and to place the file in $MY_BENCH/apps/frappe/frappe/ssOctopus.py
The dotted path is then
frappe.ssOctopus.pwd
This is hardly a solution, as it’s not upgrade safe and the code is not bundled with the Package.
You can’t have unsafe modules (like subprocess) in Server Scripts. Also, you can’t ship Python modules in a Frappe Package. A solution that requires making changes in Frappe’s editable install is far from ideal.
What you’re trying to achieve is best done through a separate Frappe App. Primarily because of the subprocess requirement - else you could achieve the same with a package.
So, I suspected that I’d have to make use of a conventional custom app, not a packaged custom app.
However, for clarification, please confirm that it’s not possible at all to define/call a whitelisted function within a packaged custom app, irrespective of whether it uses python modules, such as subprocess, or not?