“Sausage Party” easily could’ve been a one-joke affair, but directors Greg Tiernan and Conrad Vernon’s R-rated animated film isn’t just 90 minutes of food products saying and doing dirty things – although a lot of its running time is dedicated to exactly that, in a good way. What makes “Sausage Party” more than a comedy about foul-mouthed food, though, is the questions it poses about our relationship with religion, and the filmmakers milk the funny concept (no pun intended) for all it’s worth.

The movie imagines a world where the food products and other items in your local grocery store are alive, and they’re all more than ready to leave their home with a god/human in order to enter the Great Beyond. Frank (Seth Rogen), in particular, can’t wait to be chosen so he can get inside a curvy bun named Brenda (Kristen Wiig). But when Honey Mustard (Danny McBride), who was initially purchased and then returned to the store, loses it and tells all of the food that nothing but death is waiting for them outside, he causes an accident that separates Frank and Brenda from their fellow sausages and buns. The food has been comfortable with their beliefs for so long, however, that they refuse to believe Honey Mustard – except for Frank, who goes on a journey through the grocery store to prove that their gods are angry, vengeful, and above all else, really hungry.

As is the case with most animated movies about talking inanimate objects, “Sausage Party” is structured as an adventure picture, with Frank and the gang – including Teresa del Taco (Salma Hayek), Sammy Bagel Jr. (Edward Norton) and a lavash named Vash (David Krumholtz) – discovering new parts of the world. As they begin to ask the right questions, their view of the world expands, bringing them to crazy new places like the alcohol section. This whole religious element of “Sausage Party” isn’t just subtext either; it’s an integral part of the film’s story.

Religion plays a huge role in Rogen, Evan Goldberg, Ariel Shaffir and Kyle Hunter’s script. The food is basically treated like children: young, fresh and optimistic, and the longer they’ve been alive, the more questions they have about what they’ve been told or have chosen to believe in. This may sound silly for an R-rated movie about talking food, but these ideas are not always played for laughs.

The jokes themselves aren’t always consistent, but when a joke lands, it gets a huge laugh, and it’s always the kind of laugh that makes up for a few gags that don’t quite work. “Sausage Party” is a comedy that takes a lot of swings, so of course it’s going to miss a few times. Thankfully, its pacing and structure are so tight that the jokes that don’t hit their mark are quickly forgotten.

The movie has a nice and filthy sense of humor, and that’s part of its charm. The way it puts a spin on animated characters who sing and dance, for example, is unlike anything we’ve seen from a major studio release in a long time, if ever. Besides featuring some wild and unforgettable images, it’s also a really funny, crass and often thoughtful comedy that doesn’t overstay its welcome.