Before actually using OTB from a Python instance on your computer you have to make sure you have access to the relevant libraries. ArcGIS installs Python in a separate folder from that of OSGeo4W. So, if you are planning on using both ArcPy and OTB you must look closely at the paths and locations of your libraries.
For using OTB from within Python when library paths are in order, please refer to this example from the OTB cookbook. You can also launch OTBApplication commandlines directly, using subprocess.call in Python.
# Example on the use of the Smoothing application
# We will use sys.argv to retrieve arguments from the command line.
# Here, the script will accept an image file as first argument,
# and the basename of the output files, without extension.
from sys import argv
# The python module providing access to OTB applications is otbApplication
# otbApplication.Registry can tell you what application are available
print "Available applications : "
print str( otbApplication.Registry.GetAvailableApplications() )
# Let's create the application with codename "Smoothing"
app = otbApplication.Registry.CreateApplication("Smoothing")
# We print the keys of all its parameter
# First, we set the input image filename
# The smoothing algorithm can be set with the "type" parameter key
# and can take 3 values : 'mean', 'gaussian', 'anidif'
for type in ['mean', 'gaussian', 'anidif']:
print 'Running with ' + type + ' smoothing type'
# Here we configure the smoothing algorithm
# Set the output filename, using the algorithm to differenciate the outputs
app.SetParameterString("out", argv + type + ".tif")
# This will execute the application and save the output file