How to set the way asset will be imported?

I’m trying to find the proper script to set the way asset will be imported as ‘Append’.

This one doesn’t work:
bpy.data.screens[“Layout”].params.import_type = ‘APPEND’
It said: AttributeError: ‘Screen’ object has no attribute ‘params’

Anyone know how to achieve this task ?
Thank you.

Don’t trust the paths in the python tooltips.

This is a property on the editor rather than the asset library since two asset browser editors can have two different parameters.

Here’s how you can find out. Enable python tooltips and Developer extras in the preferences. Hover over the field to see the property is called “import_method” Open up the blender python docs. Type import_method in the search bar. You get there

FileAssetSelectParams

Notice is is a subclass of FileSelectParams. Click on the parent class link to get to FileSelectParams.

Scroll all the way to the bottom of the docs page. Notice this is referenced only in one place in the docs : SpaceFileBrowser.params.

Notice SpaceFileBrowser itself is a subclass of Space.

Go down to the references, notice it is used in a few places but namely AreaSpaces.active which can be access from Area.spaces which is accessed from Screen.areas.

Here’s the result

import bpy

asset_browser_area = next(a for a in bpy.context.screen.areas if a.ui_type == "ASSETS")
space = asset_browser_area.spaces.active
params = space.params
params.import_method = "APPEND"
1 Like

Thank you so much. It worked.
But for version 3.6 I’m using ‘params.import_method’ should be ‘params.import_type’