@@ -284,31 +284,28 @@ def _launch_publisher(self, action_name: str, sg_publish_data: dict) -> None:
284284 entity_ctx = engine .tank .context_from_entity (entity_type , entity_id )
285285
286286 # Launch Publisher via its registered engine command callback.
287- publisher_app = None
288287 for cmd_settings in engine .commands .values ():
289288 if cmd_settings .get ("properties" , {}).get ("app" ) is None :
290289 continue
291290 if cmd_settings ["properties" ]["app" ].name == "tk-multi-publish2" :
292291 publisher_app = cmd_settings ["properties" ]["app" ]
292+ revision_id = sg_publish_data .get ("sg_flow_revision_id" )
293+ single_file_mode = (
294+ action_name == "publish"
295+ and publisher_app .context .flow_project_id is not None
296+ )
297+ publisher_app .import_module ("tk_multi_publish2" ).show_dialog (
298+ publisher_app ,
299+ context = entity_ctx ,
300+ root_item_properties = (
301+ {"am_revision_id" : revision_id } if revision_id else None
302+ ),
303+ single_file_mode = single_file_mode ,
304+ )
293305 break
294306 else :
295307 raise TankError (
296308 "Could not find Publisher app (tk-multi-publish2)!\n \n "
297309 "Please ensure tk-multi-publish2 is configured in "
298310 "env/includes/desktop/project.yml under 'desktop.project: apps:'"
299311 )
300-
301- tk_multi_publish2 = publisher_app .import_module ("tk_multi_publish2" )
302- revision_id = sg_publish_data .get ("sg_flow_revision_id" )
303- single_file_mode = (
304- action_name == "publish"
305- and publisher_app .context .flow_project_id is not None
306- )
307- tk_multi_publish2 .show_dialog (
308- publisher_app ,
309- context = entity_ctx ,
310- root_item_properties = (
311- {"am_revision_id" : revision_id } if revision_id else None
312- ),
313- single_file_mode = single_file_mode ,
314- )
0 commit comments