A naive approach could be to have an export variable that simply toggles a different style that you can change in the editor. Create different scenes for different inventory types with the configuration you desire or alternatively, have a base class and implement specialised inventories (or just write a different script).
Note that each instance of a script is independent of other instances; e.g. each panel you create will run its own _process
and have its own variables - they aren't the same script.