Is there a way to call Python function from js?

What you're looking for is some kind of xmlhttprequest to getImportfields

I'd create a new browserview that returns getImportfields (the example below could be added to your configure.zcml to create a view called "import-fields":

<browser:page
        for="Products.CMFCore.interfaces.IFolderish"
        name="import-fields"
        class=".importexport.getImportfields"
        permission="cmf.ModifyPortalContent"
        />

You don't need a template.

This view would be accessible via @@import-fields

This could then be called via an xmlhttprequest in your tal template.