I figured it out using Visual Studio 12. For anyone else looking to do this, here is what I did. I'm guessing it is something similar with other IDEs or on other platforms.
1.) Get the Python Tools for Visual Studio https://pytools.codeplex.com/
2.) Get the pdbs for Python for mixed mode debugging. I'm using NX10 which currently uses Python 3.3.2 64 bit. https://pytools.codeplex.com/wikipage?title=Symbols%20for%20Python%20mixed-mode%20debugging (see below for how to get your version).
3.) Follow the instructions in the above link on setting up the symbols.
4.) Run NX.
5. In VS, click "Attach to Process" and select "Native code" and "Python code". Then select the ugraf.exe process
5.) Run your python code in NX.VS should stop at any breakpoints you set.
Note that if you get the wrong PDBs or don't set the path right in VS, I either got an error or a message in VS saying PDB not loaded.
If you are reading this in the future (I hope NX19 is really cool!), you can get the exact Python version being used by NX by clicking the "Developer" tab, then Edit and pasting the following code, then checking the NX log (File/Help/Log File)
print (sys.version) #parentheses necessary in python 3.
Python(stdout): 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)]
Should this work for Visiual Studio Express? I can't get breakpoints to work.
When I insert a breakpoint, I get the warning:
The breakpoint will not currently be hit. No symbols have been loaded for this document.
I don't think the debugging facility is supported in the VS Express editions. VS Express doesn't support debugging at all, for any program, in any language. Certainly this was the case a couple of years ago, and I suspect that it may still be true today.
If you've created myapp.py, then I'd guess that you can use "myapp" in the ACTIONS field of a custom menu item or a button. This sort of thing is described in the MenuScript User's Guide. It probably doesn't mention Python code, but I would expect Python code to be usable in more-or-less the same way as a DLL (for example). Caveat: I've never tried this, so I could be wrong.
thank you for your answer.
I use full path of python file(ex C://myapp.py) in the ACTIONS field of a custom menu item or a button.
but it does not work. Does anybody knows how to run python file in .menu file?
I use the newer ribbon tab/group/etc. customization files rather than the old toolbar/menu files.
In a .rtb file, I simply specify the full path to the .py journal after the ACTION label in a BUTTON definition.