Splunk Dev

How to import custom python module inside app?

seva98
Path Finder

I have tried importing Python Docx module inside my app, I have uploaded it to .../appname/lib folder and my script inside .../appname/bin couldn't find it.

Can anyone please share an example on how to upload module to app and import it in python script?

Labels (3)
Tags (2)
0 Karma
1 Solution

seva98
Path Finder

Found what was an issue, I had to move splunklib folder to .../appname/bin folder and move Python Docx module to .../appname/bin/docx and then use

import sys
sys.path.append('./docx')
sys.path.insert(0, './docx')

View solution in original post

0 Karma

seva98
Path Finder

Found what was an issue, I had to move splunklib folder to .../appname/bin folder and move Python Docx module to .../appname/bin/docx and then use

import sys
sys.path.append('./docx')
sys.path.insert(0, './docx')
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...