# How can I import .dat files in scripts?

I want to import .dat files. I can import .dat files clicking option in menu, cause I've install an plugin from here. But I don't know how to import .dat files in scripts.

I have tried read the plugin's code. The plugin's code has a folder structure like this:

-images/
-importldraw.py


In importldraw.py, I found something might be relevant to my question: loadldraw.loadFromFile(self, self.filepath) I put my script named render_script.py and files above in the same folder. But after I import loadldraw and code relevant above in my script, an error occurred. My script and the error are shown below:

#render_scripts.py
import bpy
from bpy import context
import os
import sys
sys.path.append(r'C:\Users\HL\Desktop\blender_script\importldraw')
import importldraw
path = 'D:/lego_part/ldraw/parts/8.dat'