This isn’t directly possible - you can theoretically retrieve project properties in the runtime, but modifying them wouldn’t actually do anything to your running client.
If you just need to toggle the menu bars, then that’s the approach to take. Theoeretically, something like this might work:
from javax.swing import SwingUtilities
from com.inductiveautomation.factorypmi.application import FPMIApp
fpmiapp = SwingUtilities.getAncestorOfClass(FPMIApp, <some component reference>)
if fpmiapp is not None:
# to hide
fpmiapp.clientPanel.menu = None
# to show
fpmiapp.clientPanel.rebuildMenu()