This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

How do I call an external function from a stackstorm custom python action?

I have the following structure inside my actions pack:

actions/
         __init__.py
          acl.run.py
          acl.run.yaml
          lib/
             __init__.py
             utils.py

And inside the acl.run.py script there is this import:

from actions.lib.utils import create_device

But when I try to call the acl.run.py actions I get this error:

ImportError: No module named 'actions'

I have also tried to use the relative path ( .lib.utils), but in that case I’ve got:

SystemError: Parent module 'acl' not loaded, cannot perform relative import

If i remove the acl part from the name I have:

SystemError: Parent module '' not loaded, cannot perform relative import

Since I don’t know how exactly Stackstorm loads the script can someone write here and also in the documentation how to link the lib folder (named as best practice in the documentation( to the actions scripts?

Here is an example: stackstorm-ansible/actions at master · StackStorm-Exchange/stackstorm-ansible · GitHub with lib inside actions.

2 Likes