Batch Import ascii files

I know this is possible with obj and other formats that Blender understands, however I am trying to import several .ascii files, which Blender cannot normally open and requires a plugin. The plugin works fine, but because I have so many of these files I would like to make an automated importer, similar to those for .obj.
Where should I look, or what should I try?

Something like this?

Though you will have to bring your own importer or operator here:

Yes, thank you.
I am trying to make the importer, however from bpy cannot call the operator.

Traceback (most recent call last):
  File "\Text", line 23, in <module>
  File "\Text", line 20, in import_models_from_directory
  File "C:\blender-git\build_windows_x64_vc16_Release\bin\Release\3.0\scripts\modules\bpy\", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.import_mesh.ascii" error, could not be found
Error: Python script failed, check the message in the system console

I added this to the file for the plugin:

lass ImportXNA(bpy.types.Operator, ImportHelper):
    """Load a XNALara file"""
    bl_idname = "import_mesh.xna"
    bl_label = "Import XNA"
    bl_options = {'PRESET','UNDO'}
    files: CollectionProperty(
        name="File Path",
        description="File path used for importing the XNA file",
    #I don't know what I am doing :[
    hide_props_region: BoolProperty(
        name="Hide Operator Properties",
        description="Collaps the region displaying the operator settings",
    directory: StringProperty()
    filename_ext = ".ascii"
    filter_glob: StringProperty(
    def exeute(self, context):
        import os
        from . import import_xnalara_model
        print('Started executing')
        paths = [
            for name in self.files
        if not paths:
        for path in paths:
            #import_xnalara_model.load(self, context, path)
            import_xnalara_model.loadXpsFile(self, path)
        return {'FINISHED'}

I added the class so it would register and unregister as well. What should I do to fix the ops error?

I just updated the previous code I made earlier. Do only class initialization and call the method. You can attach it to any GUI you have.

import bpy
import os

class MultiImporter:
    def __init__(self):

        # directory that contains all of the models
        self.dirpath = ''
        # models with this extensions that will be imported
        self.importedext = ''
        # all of the supported extensions with their
        # corresponding import function
        self.extensions = {
            'fbx' : bpy.ops.import_scene.fbx,
            'obj' : bpy.ops.import_scene.obj,
            'ascii' : bpy.ops.xps_tools.import_model
    def import_models_from_directory(self, dir, ext):
        # validate extension
        if ext not in self.extensions.keys():
            print(f'extension {ext} is not supported')
        # validate directory
        dir = bpy.path.abspath(dir)
        if not os.path.isdir(dir):
            print(f'directory [{dir}] does not exist')
        # get all files with this extension
        files = []
        for f in os.listdir(dir):
            # extension of file must be the same
            if ext == f.split('.')[-1]:
                files.append(os.path.join(dir, f))
        # make sure that enough files are loaded
        if len(files) == 0:
            print(f'could not find files with extension {ext}')
        # otherwise import files using the specified function
        for f in files:

imp = MultiImporter()
    r'E:\graphics\blender\collections\00\[HS] Bowsette',

1 Like