# Supporting Multiple Instances with a Custom Topic

**URL:** <https://discuss.px4.io/t/supporting-multiple-instances-with-a-custom-topic/42052>\
**Category:** PX4 Autopilot\
**Created:** [October 22, 2024, 5:14pm UTC](https://discuss.px4.io/t/supporting-multiple-instances-with-a-custom-topic/42052 "2024-10-22T17:14:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bendystraww](https://discuss.px4.io/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@bendystraww](https://discuss.px4.io/u/bendystraww)\
**Post date:** [October 22, 2024, 5:14pm UTC](https://discuss.px4.io/t/supporting-multiple-instances-with-a-custom-topic/42052/1 "2024-10-22T17:14:35Z")

</div>

Hi there, I’m hoping to get some insight into a problem I’m having with using multiple instances of the same uORB topic.

I have a custom uORB topic that I’ve made and successfully can be subscribed and published to, but I can’t seem to create multiple instances of my topic.

I’ve tried using the same method with a “pre-done” uORB topic and it works well. Here is some of the code that is working and I am trying to replicate with my new topic, which is not working.

```auto
    orb_advert_t batt_stat_pub;
    struct battery_status_s batt_stat;

    memset(&batt_stat, 0, sizeof(batt_stat));
    int instance = 1;
    batt_stat_pub = orb_advertise_multi(ORB_ID(battery_status), &batt_stat, &instance);
	if(batt_stat_pub == NULL){
		PX4_INFO("Publish error");
	}

        orb_publish(ORB_ID(battery_status), batt_stat_pub, &batt_stat);

    // In a different file
    uORB::Subscription _battery_status_updates{ORB_ID(battery_status), 1};
    struct battery_status_s batt_stat;
    _battery_status_updates.copy(&batt_stat);

```

Using this method works very well with the “pre-done” messages but does not create a new instance when I am working with a topic that I’ve added and instead the values that I publish are sent to instance 0.

Any insight would be grealy appreciated, thanks!
