Setting a command's `oncommand` to an external python function

When developing a Komodo extension, say i have this:

<commandset id="allcommands">
    <command id="Tasks:HelloWorld" oncommand=""/>

How can I set oncommand to say the function foo() in:

def foo():

also, how do I activate a popup menu such as:

 <menupopup id="popup_tools">
    <menuitem id="Test"

I pretty sure that you CAN’T use Python functions or anything else written in Python in your add-on without making an UDL and accessing it via JS.

Oh, that’s OK, I’m better with JS anyway(I just wanted to be able to use a python wrapper around a REST API). Is there a way I can use a function from an external script file?

Not sure what do you mean by “external script file”. You can download it locally and just use it (via <script>). But if your script is a part of some cool API (not sure what the correct name for that type of the API, but probably it’s a remote SDK or something like that when you include the script and just use objects and functions from that to access to the API, yes?) - I don’t know because I never tried to do that. Just try what you want and describe the result! :wink:

Cool, now the last I need to know are

  1. How to activate that popup menu
  2. Do you know of any good reference for xul layout and such. It would help if it were tainted toward Komodo.

In order to access Python from XUL/JS you would have to build your own XPCOM component, for reference you can check here:

I would not recommend this unless you are doing stuff that specifically requires Python or is very process intensive.

See the relevant documentation here:

A good way of finding documentation is to do a google search prefixed with mdn xul, eg. mdn xul menupopup is how I found the documentation link above.

Should all UI be done in the overlay file?

Depends on what you’re doing. If you’re injecting XUL into an existing XUL document then you’d probably just be using the overlay, yes.