Call set_project_environment from plugin

Issue #2 invalid
Chuck Fossen created an issue

I would like to call set_project_environment() from another plugin after updating the project env variables. I doesn’t seem to run when calling from my plugin.

Thanks

Comments (4)

  1. Daniele Niero repo owner

    Sorry for the late reply.

    I’m not sure how you’d expect to call a plugin’s function from another plugin, do you have any example of this working? Did you read somewhere that it is possible? How would you import it in the first place?
    If so I’d like to see it.

    That said, and sorry for being blunt, but how is this mine or my plugin’s problem? (edit: there was no need to be that harsh)

  2. Chuck Fossen reporter

    I call it with:

            ...
            self.data["settings"]["project_environment"]["osx"]["env"]["TEST_HOST"] = selection[0]
            self.win.set_project_data(self.data)
    
            # not sure why this is not running...
            self.view.run_command("set_project_environment")
    

    After running the plugin and then save the project file, the settings are then updated. I’m not sure why I need to save the file again since the file is already saved.

    It’s not your problem. I thought maybe you had insights into how sublime handles saving the project data and when

    Sorry to bother you.

  3. Daniele Niero repo owner

    Hi,
    you are not bothering me at all, again sorry if I have been that blunt.
    To be fair I thought you were doing something different. You want to call the command from your plugin.
    I’m not really sure why it doesn’t work, but could it be that you call the above code when your plugin is loading but mine has not been processed yet?
    It’s just a guess.
    You may find more expertise and help in the official Sublime Forum.

    Good Luck!

  4. Log in to comment