Electrical distribution networks are facing an energy transition which inter alia entails an increasing penetration of decentralised renewable energy sources and electric vehicles. The resulting increasing temporal and spatial uncertainty in the generation/load patterns challenges the operations of an infrastructure not designed for such transition. Against this background, Optimal Power Flow methods can play a key role in indentifying system criticalities and supporting the efficient management of the electrical networks, also at distribution level. In this work, in order to support distribution system operators’ decision making process, we aim at attaining a quasi-optimal solution, in the shorter time possible, in an electrical network experiencing a large growth of distributed energy sources. We propose an optimisation method based on a modified version of a genetic algorithm and on the Python pandapower package. The method is tested on a model of a real urban meshed network of a large Czech city. The optimisation method minimises the total operating costs of the distribution network by controlling selected network components and parameters, namely: the transformer tap changers and the active power demand at consumption nodes. The results of our method are compared with the exact solution showing that a close-to-optimal solution of the observed problem can be reached in a relatively short time.