BPy add Path in Textfile from Text-Editor .hi guys i have a problem by set a path in text line.
I put in a picture, maybe you understand what I mean.

i don't know how to implement the code in such a way that the path is included in the text line (see yellow arrows)
and btw. here is my code from the function:
import bpy

myPath = bpy.path.abspath('GameName\Character\Johnny') #path from &quot;Johnny&quot; 

#character list with hardcoded Animations, Speed, Name etc. without correct 
#path from character
Text = '''
DIRECTORY: \Animation\Torso\Idle_Stand\\
ANIM_NAME: Idle_Stand
ANIM_SPEED: 1.00
FRAME_FILES: Frame01.obj

DIRECTORY: \Animation\Torso\Spot1\\
ANIM_NAME: Spot_01
ANIM_SPEED: 12.50
FRAME_FILES: Frame01.obj, Frame02.obj, Frame03.obj, Frame04.obj

DIRECTORY: \Animation\Legs\Run\\
ANIM_NAME: Run
ANIM_SPEED: 3.135
FRAME_FILES: Frame01.obj, Frame02.obj, Frame03.obj
'''

t = Text

#checks if this textfile name exists
if &quot;JohnnyAnimDoc&quot; not in bpy.data.texts:
    bpy.data.texts.new(&quot;JohnnyAnimDoc&quot;)
#add &quot;Text&quot; in the textfile
txt = bpy.data.texts['JohnnyAnimDoc']
txt.from_string(t)
txt.current_line_index = 0

I hope there's an answer to my problem.
best regards -DevilSam :)
Couple of ways.

Already pointed out hassle re slosh in comments

To include a string in another block string, could use formatting, I like the old and deprecatious % Checkout the python docs for string formatting str.format(...)

text = '''
%s blah 
%s blah
%s blah
''' % (("XXX",) * 3) # all 3 occurences
print(text)


output

XXX blah 
XXX blah
XXX blah


or use a unique TOKEN and replace

print(text.replace("XXX", "YYY"))


output

YYY blah 
YYY blah
YYY blah


Since the parts are paths strongly recommend you lookup in python docs , os.path.join(...).