# Is it possible to derive the partition function from action?

According to thermal physics, any system, after an infinite amount of time, will obey the Boltzmann distribution. However as each particle follows a trajectory that minimises the action surely it should be possible to derive the Boltzmann distribution/partition function by minimising the actions

So my question is, is this possible and if so I would be interested to see how its done.