Accesing Scripts within Texteditor

Is there a way to access a function from a python plugin within a python script, which is executed in the text editor? And the other way?

import your script.
make sure the “lib” script is in the same folder as the running script.
Then type:
import libscript.py

everything should be accessible now.