Linking Custom Python scripts

I am trying to create custom menu in Mocha during startup and use the menu for running custom python scripts. If I write the entire code in init.py then that definitely works. But I am trying to create multiple scripts which are located in a certain path and those scripts should be linked to the menu inside addAction maybe. How do I achieve this? Like in Nuke there is something called “nuke.pluginAddPath”. Is there anything like this in Nuke?

As long as you import the scripts via the usual Python import process you should be able to add them as actions.
If it’s in a separate folder to the mocha scripts path, you can always do a sys.path.append to add the path and then import the scripts as usual.

Thank you

I have init.py file inside the path “C:\Users\username\AppData\Roaming\Imagineer Systems Ltd\Scripts” which has the following code:

import sys

plugin_path = ‘C:/Users/username/Documents/Projects/Mocha/’
sys.path.append(plugin_path)
import main

“main.py” is the file inside the above path which should create a menu inside mocha during startup. But the menu is not created. What could be the issue here?

Do you see any script errors in your mocha log from the help menu? This is where you will find any init-related issues.

Yes there were few errors which I got rid of. I didn’t know where to view the errors. Now I can fix the issues and also the menu is visible now. Thank you.