The following worked for me inside the function for the form
public function form( $instance ) {
$my_widget = $this;
$widget_identifier = "{$this->id_base}-{$this->number}";
}
Edit: the following also works
public function form( $instance ) {
$widget_identifier = $this->id;
}