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!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...