Can you share an example XCF? I can't see why/how a text layer wouldn't return text.
For the modules, you can either install them in your Gimp python runtime (if you are the sole user, because it will be complicated to ask the random Gimp user to do this), or you put them in the same directory as you script file, and alter the python path sys.path to include the path to you scripts (sys.argv[0]) before you do the import:
So you have a directory in the Gimp plug-ins directory that bears the name of your plugin (same name as the main Python file)
Main plugin file (importModule.py)
Imported library (someModule.py):
For the modules, you can either install them in your Gimp python runtime (if you are the sole user, because it will be complicated to ask the random Gimp user to do this), or you put them in the same directory as you script file, and alter the python path sys.path to include the path to you scripts (sys.argv[0]) before you do the import:
So you have a directory in the Gimp plug-ins directory that bears the name of your plugin (same name as the main Python file)
Code:
importModule/
├── importModule.py
└── someModule.py
Main plugin file (importModule.py)
Code:
#! /bin/env python
import os,sys
whereIAm=os.path.dirname(sys.argv[0]) # find location of executed file
sys.path.append(whereIAm) # add to Python path
import someModule # we can now import a module that's there
print(someModule.variable)
Imported library (someModule.py):
Code:
variable="imported OK" # Just to check we access this OK, so module as imported OK