To use bob nuts on a rear-hubmotor bike, you add a plate to the dropouts, with a hole in the plate for a bolt that is the right threading to put the nuts on, just behind or above the hubmotor axle, as close as you can get to the hub axle without interfering with getting it on or off, etc.
The plates then have another hole in them for the hubmotor axle, and can be held on by the hubmotor nuts. Or have them on the inside of the dropouts, if there's room, and the dropouts hold them against the axle shoulders.
IF the rear dropouts themselves have space, drill a hole for the bolt to put the bob nuts on directly in the dropout plates.